Skip to content

Instantly share code, notes, and snippets.

View Ezeji's full-sized avatar

Franklin Ezeji Ezeji

View GitHub Profile
@Ezeji
Ezeji / guid-sql-server.sql
Created September 20, 2021 21:21 — forked from akkidas/guid-sql-server.sql
Generate New Guid (uniqueidentifier) in SQL Server
-- If you want to generate a new Guid (uniqueidentifier) in SQL server the you can simply use the NEWID() function.
SELECT NEWID()
GO
-- This will return a new random uniqueidentifier e.g.
E75B92A3-3299-4407-A913-C5CA196B3CAB
To select this Guid in in a variable
--assign uniqueidentifier in a variable
DECLARE @EmployeeID uniqueidentifier