Generating GUID in SQL Server ?

NewID() funtion can be used in SQL Server to generate GUID.

For example:

Select newid();

or to select into a variable:

declare @GUID nvarchar(50);
Select @GUID=NewID();
Print @GUID;

Advertisements

#sql-server, #sql-server-tsql