Query task where clause character limit
Is there a limit on the string length for a Query Task's Where argument?
I have a Query Task that is sometimes erroring out, and I think the cause is that my where clause is too long. I can't get it down to the exact number, but it appears that if the where clause string length exceeds 6,600 characters, then it errors out. If it's under (the closest I got to the limit was 6,584), then it works.
I know that sounds like a ridiculous length, so here's the explanation. I'm building a tool for my police department so they can choose multiple items from a list box of police call types. I want my users to be able to select one, some, or all case types and use different radio buttons to define the time frame (last 24 hours, week, month, etc.) to select police calls. There are 264 different call types, and their combined string length alone is 2,515. Add to that the syntax for the where clause (CallType = 'type1' OR CallType = 'type2' etc.), and you can see how quickly the length adds up.
0
-
John,
The Query Task doesn't necessarily have a maximum length, however the submitting URL does. This varies but rule of thumb is anything over 2000 characters is getting gamey.0 -
Bummer, but thanks for the info. Interesting that it works fine up to 6,600 characters. I tested that in IE, Chrome, and Firefox just to confirm. 0 -
You can shorten your WHERE clause by using the IN operator. 0 -
Brilliant idea, Nico, thanks! I can easily run the query with all call types now because the max length will stay under 3,400 characters. 0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
5 kommentarer