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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve Inserted Uniqueidentifier 1

Status
Not open for further replies.

RiverGuy

Programmer
Jul 18, 2002
5,011
US
I have tables with UNIQUEIDENTIFIERS as the primary keys. The default is NEWSEQUENTIALID(), to help with generating keys in ascending order by default. After inserting records into the tables, I want to be able to return the key value which was just inserted. This doesn't seem possible with the NEWSEQUENTIALID() default. I've seen examples where an insert stored procedure will generate a random key with SELECT @SomeVariable = NEWID()--then using that value to insert into the table and return to the calling connection. However, NEWID() is less than desirable in this case. Does anyone have any ideas how to get that value back with the current set up I've described?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top