I believe that gives you the Identity across all connections/users, not just the record that you created. There’s a help topic in Clarion " Server Side Auto incrementing" that addresses the issue. Otherwise, you can just access the highest numbered identity field and simplfy your code.
SomeTable FILE,DRIVER('MSSQL'),OWNER(Glo:Owner),NAME('dbo.SomeTable'),PRE(Som),CREATE
PKSysIDKey KEY(Som:SysID),PRIMARY,NOCASE
record RECORD
SysID LONG
END
END
The new MSSQL2 driver makes use ofvthe RETURNING clause. When you do an ADD , and the table contains identity [1] fields then those are returned by the INSERT INTO and automatically populated into the record for you.
In other words, theres nothing for you to fo, the new value is just “there”.
[1] returning works on other fields to. Like ReadOnly and fields-with-defaults-not-included-in-the-add.
I still don’t understand what you’re trying to do, Don.
Are you inserting into MSSQL or is a different app doing it?
Do you have control over the SQL table (could you use a GUID instead of autonumber?)
What are you going to do with the just-inserted identity value when you retrieve it?