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.
| Author |
Topic |
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2004-12-10 : 04:29:25
|
| I just thought of something: instead of storing GUIDs in the database as uniqueidentifiers wouldn't it be better to store them as varchar? Or am I way off here? If one makes sure to validate that it actually is a guid before inserts, wouldn't you save alot of disk space? I must admit I have never really understood completely how this "length" attribute works...--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-12-10 : 04:40:52
|
| Not so save space.uniqueidentifier: 16 bytesvarchar(36): 36 bytesDo You mean DATALENGTH ?rockmoose |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2004-12-10 : 05:32:30
|
| Now that's why I felt sort of silly asking the question. Since a GUID is actually 36 charaters and not 16 I assumed that it was sort of like a pointer to some other place like with the text datatype. But only now I realised that a GUID consists of hex-values and they are two characters each. One byte per hex then, eh?--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-12-10 : 06:16:20
|
| Each byte(8bits) stores 2 hexadecimal(4bits) values(0-F).rockmoose |
 |
|
|
|
|
|