[dba-SQLServer] Strange limit

Gary Kjos garykjos at gmail.com
Thu Nov 15 13:40:18 CST 2012


This page talks about doing 30K values in an in clause in 2005 or 2008.

http://stackoverflow.com/questions/1869753/maximum-size-for-a-sql-server-query-in-clause-is-there-a-better-approach

GK

On Thu, Nov 15, 2012 at 1:27 PM, David McAfee <davidmcafee at gmail.com> wrote:
> I don't think so. I run large manual queries like this.
>
> I update a table yesterday with several hundred IDs in an in clause.
>
> Can you dump the IDs into a temp table or table variable and select from or
> join to the temp table?
>
> On Thu, Nov 15, 2012 at 11:06 AM, jwcolby <jwcolby at colbyconsulting.com>wrote:
>
>> I am running the folliowing query:
>>
>> SELECT     Column_Number, Column_Name
>> FROM         _DataDB101.dbo.DB101_**ConsumerLayout
>> WHERE     (Column_Number IN ('241', '54', '64', '132', '191', '186',
>> '133', '63', '139', '185', '129', '151', '201', '147', '127', '113',
>> '261')) OR
>>                       (Column_Name IN ('145', '141', '187', '52', '122'))
>>
>> Notice that I am asking for about 22 values in an In() clause.  SQL Server
>> is cutting it off after the 17th value returned.
>>
>> I never knew there was such a limit though of course there would be some
>> limit.  17 is rather small.
>>
>> --
>> John W. Colby
>> Colby Consulting
>>
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>



-- 
Gary Kjos
garykjos at gmail.com


More information about the dba-SQLServer mailing list