Updated on Kisan Patel
To get a random unique value (Guid – Globally Unique Identifier) in SQL Server, we use NEWID function.
SELECT NEWID()
You can also create a unique value of type uniqueidentifier.
DECLARE @myid uniqueidentifier
SET @myID = NEWID()
PRINT 'Value of @myID is: '+ CONVERT(varchar(255), @myID)