November 15, 2002 at 12:34 am
I have a stored procedure that I am using to insert a new record. I want to return the PK, a UNIQUE IDENTIFIER (GUID), back to my FE Client. @@Identity would be perfect but unfortunately only returns numerics. I am trying to avoid having the Client generate the GUID, if at all possible.
I've looked into IDENT_CURRENT() & SCOPE_IDENTITY( ) which are supposed to return SQL Variants but they seem to be returning numerics as well.
Many thanks in advance,
David
November 15, 2002 at 1:20 am
The answer was in the archives! Darn, sorry for the post!
November 15, 2002 at 5:01 am
November 15, 2002 at 6:17 pm
It is probably easier to generate the guid in the sql and return it
i.e
declare @GUID uniqueidentifier
set @GUID = newid
insert into mytable (...) values (@guid)
select @GUID
depends how you are doing the insert
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply