New Guid (unique identifier) in SQL Server
GUID (Global Unique Identifier) is one of the good concept in SQL Server. In most of the places we will use the GUID.Examples to use GUID in Sql server:
1. Create new GUID: below SQL statement will create the GUID.select NEWID() [New GUID]
2. GUID in a variable: Below statement will print the new guid. we will use these variable guid's in the stored procedures, functions, triggers and others.
DECLARE @EmpID uniqueidentifier SET @EmpID = NEWID() Print @EmpID
3. GUID in a new row: In the below SQL Statement, we are using GUID for creating a table column and inserting values into tables.
create table empExample (eid uniqueidentifier, ename varchar(40),
salary numeric) insert into empExample values(NEWID(),'Ranga Rajesh', 900000)
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.