I am trying to create a CAML query that selects all list items that do not have just a BR tag in them. Whenever I create a query filter:

    <FieldRef Name="ThreadId" />
    <Value Type="Text" Source="HttpParameter" SourceName="ThreadId" />
    <FieldRef Name="Body" />
    <Value Type="Note">&lt;BR&gt;</Value>

I get an error:

The data types ntext and nvarchar are incompatible in the not equal to operator.

How can I filter out fields that contain just a BR tag?


What are you doing with the results from the query ? Using XSLT to display ? Can you filter out on 'display' ?

I think the NOTE field type is stored as a BLOB in SQL, and so can be used for a comparison (EQUAL or NOT EQUAL).

Same goes for the Search API - with a coded FullTextQuery - you can't do a WHERE clause using a NOTE field type.

| improve this answer | |
  • Some cursory web searching indicates that yes fields of type Note cannot be used in CAML queries! – Alex Angas Apr 9 '10 at 2:44
  • I am using Quest Web parts to display the result of the query and I am trying to suppress rows that don't have any info. The problem is that some "Body" fields have a "<BR>" character in them and still try to display. Maybe there is something else I can do on the Quest side of things. – Anonymous Apr 9 '10 at 16:09

Have you tried <Value Type="Note"><!CDATA[<BR>]]></Value> ?

A very useful tool for creating CAML queries is U2U CAML Builder: Here

| improve this answer | |

Came across this in the past which goes on about a Contains or "Like" operator in CAML...


Might be of some help or direction.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy