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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Procedures and retrun values from an insert

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-03-24 : 07:42:21
Paul Horsley writes "Dear Team,

Question?

How can I get the primary key in a return parameter from a stored procedure that inserts a new record into a table, the Primary key is an Identity.

I want to be able to add a record and then get back the new entity to use for some other inserts to other tables that are linked from Table#1 on teh identity primary key

Sorry to hav eto ask but I have not clue, and have not any books to help me.

kindest regards Paul "

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-03-24 : 08:18:53
quote:

Paul Horsley writes "Dear Team,

Question?

How can I get the primary key in a return parameter from a stored procedure that inserts a new record into a table, the Primary key is an Identity.

I want to be able to add a record and then get back the new entity to use for some other inserts to other tables that are linked from Table#1 on teh identity primary key

Sorry to hav eto ask but I have not clue, and have not any books to help me.

kindest regards Paul "



@@identity gives u the identity which was recently inserted.
check in BOL for details.
regards,
Harshal.

Expect the UnExpected
Go to Top of Page
   

- Advertisement -