From the question 'SQL IN equivalent in CAML' I learned that SharePoint 2010 has a SQL "IN" equivalent for CAML. Also that the 2007 version does not support this. The OP solved this by nesting a bunch of OR statements to achieve the same result. I tested this and the nesting indeed does the magic, but...
In my case I'm getting items from a list with around a 1000 items. I dynamically create a statement with all the IDs in nested OR-blocks for my CAML-query. I didn't worry about the big number of nested blocks as this is what MSDN states about the OR-element:
Occurrences: Minimum: 0, Maximum: Unbounded.
and:
This element can be nested inside other Or and And elements. The server supports unlimited complicated queries.
When I call the GetListItems-method from the SharePoint 2007 built-in webservice, I get following error:
Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.
My code is written correctly because I tested the same code with only 5 nested Or-elements and the result is as expected. My question is: what IS the limit of nested Or-elements? I cannot find this anywhere as Microsoft claims this is unlimited.
Thanks in advance!