When doing a orderby by for a sharepoint field. The error below is generated:
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
The CAML query orderby clause is as follows:
<Where>
<And>
<And>
<Eq>
<FieldRef Name='ContentType' />
<Value Type='Choice'>Documents</Value>
</Eq>
<Eq>
<FieldRef Name='UserID' />
<Value Type='Text'>UserID_VAL</Value>
</Eq>
</And>
<Neq>
<FieldRef Name='Email' />
<Value Type='Text'>NA</Value>
</Neq>
</And>
</Where>
<OrderBy>
<FieldRef Name='Description' Ascending='TRUE' Nullable='TRUE'/>
</OrderBy>
The field being sorted was Description and it has the following data type in the list Description Single line of text.
Any solutions to this problem.
Thanks in advance.