I have a stored procedure that inserts multiple rows into a table via a USER defined tyble. The user defined type is populated from a c# datatable.
Within the stored procedure, before the insert command with the datatable executes, I have another insert command into another table. Scope_Identity() to grab the ID of the newly inserted row and assign it to a variable.
What I would like to do is add that ID to all the rows that are added with the User defined type.
What's the best way to do this? How can I incorporate the Scope_Identity value into the insert statement?