terça-feira, 9 de março de 2010

The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.

Durante o deploy de uma tabela com informações de trace, encontrei a seguinte mensagem:

Msg 306, Level 16, State 2, Line 1
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.

Erros com severity level 16, são gerados pelo usuário e podem ser corrigidos pelo usuário. Campos BLOB não podem ser usados na cláusula GROUP BY.
Alterei a query e onde antes estava:
select
      TextData
from
      Altitude.Trace_Performance_02032010
where
      duration > 10000
group by
      TextData

Mudei para:
select
      Cast(TextData as Varchar(8000)) as TextData
from
      Altitude.Trace_Performance_02032010
where
      duration > 10000
group by
      Cast(TextData as Varchar(8000))
Até a próxima!


Nenhum comentário:

Postar um comentário

Leave your comment here!