If you want it done right, do it yourself! Login and vote now.
By mswatcher
via objectreference.net
Submitted: May 23 2008 / 12:51
Recently I had to write an insert stored procedure and needed to return the ID of the row I was inserting. While writing my usual bad SQL I came across a fascinating function I’ve never used before, SCOPE_IDENTITY().
Here's short example of how you can use the SCOPE_IDENTITY() function while doing an SQL INSERT to return the identity value of the row just inserted.
Add your comment