|
Using Uniqueidentifier(GUID) in Aggregate Operations (MS SQL Server)Average Rating: 4.5/5 | Rate this item | 2 users have rated this item.
|
Expertise: Beginner
Language: Enterprise
February 12, 2001
Using Uniqueidentifier(GUID) in Aggregate Operations (MS SQL Server)
Uniqueidentifier(GUID) can't be used in aggregate operations like count(),
etc. This problem may be solved by casting uniqueidentifier as varchar. Presuming that guid_column is a uniqueidentifier column:
select count(cast(guid_column as varchar(36)) from a_table group by
guid_column
Michael Ginzburg
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tip here.
|