Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 What is the uniqueidentifier data type stored as?

Author  Topic 

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2005-08-25 : 11:55:39
Maybe I'm blind but I can't seem to find any documentation that says specifically what a uniqueidentifier data type is stored in the database as.

INT = 4 bytes
BIGINT = 8 bytes
SMALLINT = 2 bytes
DATETIME = 8 bytes (2x4INT)
UNIQUEIDENTIFIER = ?


Thanks,
Daniel

Kristen
Test

22859 Posts

Posted - 2005-08-25 : 12:26:26
SELECT LEN(CAST(NewID() as varbinary(1000)))



Kristen
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-08-25 : 13:30:43
It's stored internally in a 16 byte column.
Think of it as a really big integer that you can't do any math operations with.

CODO ERGO SUM
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-26 : 02:07:18
>>SELECT LEN(CAST(NewID() as varbinary(1000)))

Kris, Any reason you used 1000
It seems to work for any number greater than 15

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-08-26 : 02:27:35
Just to make sure it was "big enough"

Kristen
Go to Top of Page
   

- Advertisement -