Re: INSERT
From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 02/21/04
- Previous message: Darren: "INSERT"
- In reply to: Darren: "INSERT"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 21 Feb 2004 13:07:07 +0530
hi darren,
>>When they are done filling this form they go to a page
with links to the other pages. I need to be able to pull
the identity column parameter for that workorder to use
as a link to the other pages. <<
Look at the function scope_identity() in books online. This function returns the last IDENTITY
value inserted into an IDENTITY column. After running INSERT statement into the table run
SCOPE_IDENTITY()
Ex:
declare @x int
CREATE TABLE TY (
Y_id int IDENTITY(1,1)PRIMARY KEY,
Y_name varchar(20) NULL)
go
INSERT TY (Y_name) VALUES ('x')
INSERT TY (Y_name) VALUES ('y')
go
SET @x=SCOPE_IDENTITY() --@x will consist of last identity value inserted into table TY
-- Vishal Parkar vgparkar@yahoo.co.in
- Previous message: Darren: "INSERT"
- In reply to: Darren: "INSERT"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|