To create a new uniqueidentifier or GUID (Globally Unique Identifier) in SQL Server use the newid() function:
select newid()
This function can be useful for creating test data but there is another use. It's also possible to select a random record using the script below:
select top 1 *
from dbo.Customer
order by newid()
I can't really think of any situation where this randomisation technique would have been helpful but, you never know !
Wednesday, November 08, 2006
Create a new GUID in SQL Server
Subscribe to:
Post Comments (Atom)
3 comments:
Well I enjoyed it!
thats works!! cool..
Thanks
cool ;)
Post a Comment