T-SQL Tutorial

Uniqueidentifier - TSQL Tutorial


On Transact SQL language the uniqueidentifier is a character type for the purposes of conversion from a character expression.

Uniqueidentifier syntax:

uniqueidentifier

Uniqueidentifier example:

USE model;
GO
DECLARE @id_var uniqueidentifier = NEWID();
SELECT @id_var AS 'Result';
GO

Result
4BCF38AD-BB98-42CA-82D3-97DBE081EB4B