Hi, Borislav
I'm not arguing that - GUID will generate more traffic. I was just pointing that the 36 char string you see is a conversion of the actual GUID into string, using StringFromGuid2. That is not the real GUID.
However, using GUIDs sometimes is the only way to solve some specific problems (such as adding records together from multiple databases). Integers would be a nightmare in this scenario. Been there, done that, unfortunatelly. :)
>>Not really. GUID is just 16 bytes long, not 36. On the other hand, MSSQL has no function that returns the last GUID inserted automatically, that's why it should be generated by the client, which makes only one hit into database - Insert the record. The Id is already known.
>
>My UNIQUEIDENTIFIER field gives me 36 bites in SQL 2005, but let it be 16.
>When you insert record ID (IDENTITY) field is NOT sent back to the DB, so when you insert the field you didn't pass 4 bites to BackEnd, After you insert the record you want that 4 bites from BackEnd. So what is better to SEND 16 bites every time when you insert record or to ask for 4 bites? Also in query:
>
>SELECT MyId, ....
> FROM Table
>
>which type will generate more transfer? That with 4 byte integer or 16 byte GUID?
Grigore Dolghin
Class Software.