Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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:

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

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

3 Answers 3

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

http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/15766fd5-50d5-4884-82a1-29a1d5e38610

Might be of some help or direction.

share|improve this answer

Your Answer

 
discard

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