2

Here's what I'm trying to do: I add a record to the table. This record receives its unique ID number (identity). Then I want to use this ID in my code. How can I find out which ID number has just received a newly added record in my SQL Server database table?

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
aszDragua
  • 31
  • 2

1 Answers1

1

Add an output parameter to your insert statement and return scope_identity(). If this isn't sufficient just search my answer, it will be in here a bunch.

KeithL
  • 5,023
  • 3
  • 18
  • 24