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 2005 Forums
 Transact-SQL (2005)
 uniqueidentifier vs Char(36)

Author  Topic 

Luke101
Starting Member

30 Posts

Posted - 2009-08-14 : 13:18:22
Hello,
I have been using char(36) for my GUID columns. A buddy of min told me I should use the uniqueidentifier datatype instead. Is their any difference in performce using either?

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2009-08-14 : 13:31:25
yes. storage for char(36) is 36 bytes, uniqueidentifier is 16 bytes.

if you have joins on this column, they will work better if you use uniqueidentifier.

furthermore, there is the integrity issue. you can put anything in a char(36) and sql server won't complain, for example 'zzzzzzzzzzzzzzz'. this wouldn't be allowed with uniqueidentifier.


elsasoft.org
Go to Top of Page

jeffreymfischer
Starting Member

10 Posts

Posted - 2009-10-07 : 11:12:03
I've written a detailed article on an enterprise-ready unique identifier solution.

http://blog.scoftware.com/post/2009/08/29/SQL-Server-UniqueIdentifier-Globally-Unique-Globally-Sequential-SOLUTION.aspx

Read it and provide feedback.

Jeff Fischer

Scoftware Achitect/Developer
http://blog.scoftware.com
Go to Top of Page
   

- Advertisement -