devxlogo

Using Uniqueidentifier(GUID) in Aggregate Operations (MS SQL Server)

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

size=3>

devx-admin

Share the Post: