|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to return the auto increment fields?Sorry for newbie question,
I am going to create a stored procedure for two task: Inset a row to a table, and return the Identity field(which is auto-increment) to the program. Thanks. You can get the new value with select @@identity or select
scop_identity(). You can find more about both functins in Books on line. Adi Cylix wrote: Show quote > Sorry for newbie question, > I am going to create a stored procedure for two task: > > Inset a row to a table, and > return the Identity field(which is auto-increment) to the program. > > Thanks. If you are on SQl Server 2005, you can also use the ne OUTPUT clause
which will allow you to pass back a variable within a statement. In C# you would probably add a parameter with either the direction IN or IN/OUT. HTH, Jens Suessmeyer. --- http://www.sqlserver2005.de --- |
|||||||||||||||||||||||