Thursday, June 07, 2007

Another way to get the identity of a new record

set nocount on

Declare @NewPersonnel_ID int

insert into tbl_Personnel
(
Personnel_Status_ID,
Name_First,
Name_Middle,
Name_Last,
Display_Contact_Us,
Personnel_Version_Info,
Creation_user,
Creation_Date
)
VALUES (
58, -- Check to see if 58 is the right choice. [looks it up] It is the right choice: (active)
'Leon',
'J.',
'Leach',
0,
'[eheard] Added manually per bug 2179',
115,
'3/29/2007'
)

set @NewPersonnel_ID = (SELECT @@IDENTITY)

set nocount off

Labels: