I have a database that has a tble with a field that autoincrements as a primary key. meanig that the field type is BigInteger and it is set up as my Identity Column. Now when I insert a new record that field gets updated automaticly.
How can I get this value in the same operation as my insert? meaning, in 1 sub, I insert a new record but then need to retieve the Identity Value. All in the same procedure.
Waht is the way to achive this please?
Marc
What I do is issue the two commands (the sql insert, and the sql select scope_identity) in the same execute separated by semi colon.
the trick is to set the parameter direction to output for the identity.
David H. has a good article.
http://davidhayden.com/blog/dave/archive/2006/02/16/2803.aspx
|||
Thank you very much. that did it!
Marc
No comments:
Post a Comment