[SQL] NEWID()

The following is the syntax of getting a unique ID using the NEWID() function. First, declare a variable to store the unique ID and then set the unique ID to the variable.

DECLARE @chvGUID VARCHAR(20)
SELECT @chvGUID =  (LEFT(NEWID(),(20)))

A common NEWID() function will return values for example like this, ‘A972C577-DFB0-064E-1189-0154C99310DAAC12’