Introduction
GUID is generated to unique identifier No. GUID is created through network card.SQL Server have data type uniqueidentifier, A sample database snapshot has been provided below:
Guid in SQL |
--Code snippet shwoing uniqueidentifier in a variable
DECLARE @TechnologyCrowdsID uniqueidentifier
SET @TechnologyCrowdsID = NEWID()
SELECT @TechnologyCrowdsID
We can generate uniqueidentifier using NEWID() in SQL, I have provided code snippet below:
SELECT NEWID()
Above code sample shows best example of Guid in SQL
I have provided C# code snippet to generate following:
Namespace using System
using System; class TechnologyCrowds { public static void Main() { Guid Gtc; // Create and display the value of two GUIDs. Gtc = Guid.NewGuid(); Console.WriteLine(Gtc); Console.WriteLine(Guid.NewGuid()); } } /* Above code example will produce the below results: 0D1C39FA-D58D-4C4D-A910-33A07116CB89 B1CB4977-AD8C-4D11-8D87-87F471A319F7 */
Post A Comment:
0 comments: