Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Select Stored Procedure

Status
Not open for further replies.

EscapeUK

Programmer
Jul 7, 2000
438
GB
I need a store procedure that first of all inserts a record then returns the ID number which is automatically generated for the inserted record.

Can this be done in the same stored procedure, if yes can you help with the code.
 
INSERT X,y,Z
INTO tblABC VALUES (1,2,3)

Return (@@Identity)

This assumes that the table has an identity field defined as the primary key.

hope this helps,

Chris Dukes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top