Solved

RowGuid and Stored Procedures

Posted on 2001-08-10
4
753 Views
Last Modified: 2008-03-17
Is there something similar to @@Identity that will return the rowguid when you do an insert into a table with a NewID coluimn on it?

Dave
0
Comment
Question by:howesdav
4 Comments
 
LVL 4

Accepted Solution

by:
vindevogel earned 50 total points
ID: 6372150
You can do this ...

Declare @GUID UniqueIdentifier

Set @GUID = newid()

Insert into yourtable (PKGUID, FIELDS)
Values (@GUID, @FIELDS)

You don't receive it back, but you create it before, store it and you can still use it.
0
 

Expert Comment

by:CleanupPing
ID: 9281862
howesdav:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9776351
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Award points to vindevogel

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Anthony
EE Cleanup Volunteer
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question