Tuesday, April 22, 2008

Want a GUID From SQL Server?

Use this command


NEWID()



Here's a sample. Notice the length of the variable required to hold your GUID.


declare @MyNewGUID varchar(255)

set @MyNewGUID = NEWID()

print @MyNewGUID

No comments: