ahmd0
ahmd0

Reputation: 17293

Most efficient way to store a GUID value in SQL Server database

Say, if I need to store non-repeating GUID values (something like {AB50C41E-3814-4533-8F68-A691B4DA9043}) in the SQL Server database, what is the most efficient way to define the column to store it? (i.e. as string, a blob, or convert it into a 16-byte integer.)

PS. The column must be defined as an INDEX and be UNIQUE.

Upvotes: 46

Views: 34705

Answers (2)

gbn
gbn

Reputation: 432271

Note, these are 2 separate steps

Upvotes: 65

Pavan
Pavan

Reputation: 4329

You can use uniqueidentifier datatype

Upvotes: 12

Related Questions