tags:

views:

100

answers:

1

How would you go about retrieving the @@IDENTITY value for each row when the SQLDataAdapater.Update is executed on a table?

eg. Is it possible to modify/intercept the InsertCommand, generated by the SQLCommandBuilder, to say add an output parameter, and then retrieve its value in the da.RowUpdated event???

+1  A: 

Bill Vaughn knows a thing or two about this. They key is tweaking your InsertCommand.

See "Managing an @@IDENTITY Crisis".

Note: the actual solution uses SCOPE_IDENTITY() in order to be trigger-safe.

Pittsburgh DBA