Generate new GUID in SQL Server

Posted by Gopesh9 under Sql Server category on | Points: 40 | Views : 2453
If you want to generate new Guid i.e Unique Identifier in SQL Server, You can do that simply by using NEWID()


DECLARE @CustomerID uniqueidentifier
SET @CustomerIDID = NEWID()

You can also use it when you want to insert the value in the database

insert into Customer(CustomerID, Name) values(NEWID(),'John')

Comments or Responses

Login to post response