SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|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

share|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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.