` Retrieving Identity value from MSSQL (Sebastian Streiger) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

SQL Related Articles: Retrieving Identity value from MSSQL
2003-11-24 -- Sebastian Streiger
 
Newsgroups: softvelocity.public.clarion6 Access:Customer.TryInsert() Customer{Prop:SQL} = 'SELECT @@IDENTITY' If Access:Customer.TryNext() <> Level:Benign !Something went wrong here End MESSAGE(Customer:SysId) !Now you should get what you wanted. !This will return the value of the last identity inserted in the current session. !No posible clash with other users !I'm asumming that Customer:SysId is the first field in the Customers table. !If it's not you should add dummy values to the select so that the identity fits the proper buffer position Just one warning. @@IDENTITY is a MSSQL variable, it won't work with another back-end. Also it returns the last inserted identity of the current session, no matter wich tabl;e was the last that was inserted into. So you should be aware that a trigger for example can make the previous code errorneous. Hpe this helps -- Sebastián Streiger IT Department Red Megatone


Today is November 21, 2024, 3:50 am
This article has been viewed 35210 times.
Google search has resulted in 303 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: