Symptoms

In Cognos, when trying to access a table with a custom SQL query, an error message is raised:

Using a blob column in this query requires that the query subject [Q1].[SQL1] must have either a key or a unique index.
DPR-ERR-2082 An error has occurred. Please contact your administrator. The complete error has been logged by CAF with SecureErrorID:2015-04-24-05:58:56.501-#201


Reason

Some of the columns returned by the query are of blob data type (binary large object), e.g. NVARCHR(MAX).

Resolution

If the data for this column can be limited in length, please add a cast to your SQL query, e.g:

   CAST(ut.udftext AS NVARCHAR(200)) AS [MyCustomField]

Alternatively, in your query properties, please select No for the “Auto Group & Summarize” option.