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

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: