Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-03-11 : 08:07:22
|
| angelo d corbo writes "I have a procedure that performs two INSERTS in two different tables. What I find a problem is that the second INSERT requires the a primary ID number of the newly created record by the first INSERT. I'm not sure how to manage this.Is there a way to control the flow within a single procedure so that a variable can be SET with the ID of the newly created record? or I need to call a second procedure that performs the second INSERT after the first procedure/INSERT is completed??" |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-03-11 : 08:33:43
|
| if the PK of the first record is an identity column use "scope_identity()" Look it up on books on line.Be One with the OptimizerTG |
 |
|
|
|
|
|