Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uniqueidentifier Equivalent DataType In C#

Tags:

c#

sql

c#-3.0

what is uniqueidentifier (Sql server 2005) equivalent in C# 3.5 datatype ?

like image 509
Asim Sajjad Avatar asked Apr 30 '10 10:04

Asim Sajjad


People also ask

What data type is Uniqueidentifier?

The globally unique identifier (GUID) data type in SQL Server is represented by the uniqueidentifier data type, which stores a 16-byte binary value. A GUID is a binary number, and its main use is as an identifier that must be unique in a network that has many computers at many sites.

How do you use Uniqueidentifier?

Type the below code in SSMS and execute. DECLARE @guid uniqueidentifier = NEWID(); SELECT @guid as 'GUID'; Here we created a variable named guid of data type uniqueidentifier.

How do I create a Uniqueidentifier in SQL?

-- If you want to generate a new Guid (uniqueidentifier) in SQL server the you can simply use the NEWID() function. -- This will return a new random uniqueidentifier e.g. You can directly use this with INSERT statement to insert new row in table.


1 Answers

It should be System.Guid or Nullable<Guid>

like image 73
Jehof Avatar answered Oct 25 '22 20:10

Jehof