Retrieving the GUID value of an inserted row

By Bill Graziano on 3 June 2002 | Tags: Data Types


Narayana Vyas Kondreddi submitted "This is yet another FAQ from Microsoft public SQL Server newsgroups. Lot of SQL Server developers are used to using @@IDENTITY to retrieve the value of the IDENTITY column immediately after inserting a row. We are missing that functionality when it comes to inserting rows with GUIDs as keys. Unfortunately, there's no equivalent to @@IDENTITY, when it comes to GUIDs. Here are three ideas to help you retrieve the GUID value immediately after inserting a row."

Link: Retrieving the GUID value of an inserted row


Related Articles

Using the TIME data type in SQL Server 2008 (6 March 2008)

Using the DATE data type in SQL Server 2008 (6 December 2007)

Working with Time Spans and Durations in SQL Server (15 October 2007)

DATEDIFF Function Demystified (20 March 2007)

The Cost of GUIDs as Primary Keys (8 January 2005)

Search and Replace in a TEXT column (18 January 2004)

INF: Frequently Asked Questions - SQL Server 2000 - Table Variables (7 December 2003)

How to search for date and time values (2 May 2003)

Other Recent Forum Posts

SQL Server detected a logical consistency-based I/O error: torn page (expected signature: 0xaaaaaaaa; actual signature: 0xfffffffe). It occurred during a read of page (1:908) in database ID 99 at offset (48m)

Case stmt in SSIS (18h)

Upgrading from MSSQL 2016 to 2017 (1d)

Why does CASE WHEN NULL IN (SELECT A FROM B) THEN 'Y' ELSE '' AS [NULL] does not work? (1d)

Tensorflow package installation on SQL 2019 ML Services (1d)

How can I reference the table (T1 JOIN T2 ON A=B JOIN T3 ON C=D)? (1d)

Is there an easy way to populate a column with an INDEX/MATCH statement? (1d)

Is joining table completely deceiving? (2d)

- Advertisement -