Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 392237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:08:22+00:00 2026-05-12T16:08:22+00:00

I think i am hitting a limit. I have two IN statements in the

  • 0

I think i am hitting a limit. I have two IN statements in the SQL generated by subsonic. Or am I hitting the varchar ( 8000 ) limit?

When I send i fewer parameters, the statement returns results, when I send in more, the result set comes back blank.

Below is what I am catching in SQL Profiler:

exec sp_executesql N'/* GetDataSet() */ 
 SELECT 
   [dbo].[QuoteDBAll].[quote_id], 
   [dbo].[conn_quote_result].[product_category_name], 
   part_number, 
   quote_result_special_price * ( quote_result_quantity + quote_result_quantity_spare) AS Total, 
   company_name
 FROM [dbo].[QuoteDBAll]
 INNER JOIN [dbo].[conn_quote_result] 
   ON [dbo].[QuoteDBAll].[quote_number] = [dbo].[conn_quote_result].[quote_number]
 INNER JOIN [dbo].[conn_company] 
   ON [dbo].[QuoteDBAll].[company_id] = [dbo].[conn_company].[company_id]
 GROUP BY [dbo].[QuoteDBAll].[quote_id], 
   [dbo].[conn_quote_result].[product_category_name], 
   [dbo].[conn_quote_result].[part_number],
   [dbo].[conn_quote_result].[quote_result_quantity], 
   [dbo].[conn_quote_result].[quote_result_quantity_spare], 
   [dbo].[conn_quote_result].[quote_result_special_price], 
   [dbo].[QuoteDBAll].[quote_status_id], 
   company_name
 HAVING (quote_status_id = @quote_status_id0)
   AND (company_name IN 
     (@in1,@in2,@in3,@in4,@in5,@in6,@in7,@in8,@in9,@in10,
     @in11,@in12,@in13,@in14,@in15,@in16,@in17,@in18,@in19,@in20,
     @in21,@in22,@in23,@in24,@in25,@in26,@in27,@in28,@in29,@in30,@in31))
   AND ([dbo].[conn_quote_result].[product_category_name] IN 
     (@in1,@in2,@in3,@in4,@in5,@in6,@in7,@in8,@in9,@in10,
     @in11,@in12,@in13,@in14,@in15,@in16,@in17,@in18,@in19,@in20,
     @in21,@in22,@in23,@in24,@in25,@in26,@in27,@in28,@in29,@in30,
     @in31,@in32,@in33,@in34,@in35,@in36,@in37,@in38))', 
N'@quote_status_id0 varchar(1),@## varchar(8000),@in1 varchar(15),@in2 varchar(22),
  @in3 varchar(21),@in4 varchar(13),@in5 varchar(5),@in6 varchar(6),@in7 varchar(13),
  @in8 varchar(25),@in9 varchar(8),@in10 varchar(14),@in11 varchar(9),@in12 varchar(11),
  @in13 varchar(16),@in14 varchar(12),@in15 varchar(14),@in16 varchar(16),
  @in17 varchar(11),@in18 varchar(15),@in19 varchar(6),@in20 varchar(12),
  @in21 varchar(12),@in22 varchar(10),@in23 varchar(15),@in24 varchar(15),
  @in25 varchar(15),@in26 varchar(11),@in27 varchar(16),@in28 varchar(20),
  @in29 varchar(6),@in30 varchar(16),@in31 varchar(17),@in32 varchar(11),
  @in33 varchar(18),@in34 varchar(23),@in35 varchar(14),@in36 varchar(19),
  @in37 varchar(12),@in38 varchar(14)', 
@quote_status_id0 = '1', @## = NULL, @in1 = 'Widget1', @in2 = 'Widget2', 
@in3 = 'Widget3', @in4 = 'Widget4', @in5 = 'Widget5', @in6 = 'Widget6', @in7 = 'Widget7', 
@in8 = 'Widget7', @in9 = 'Widget7', @in10 = 'Widget8', @in11 = 'Widget9', @in12 = 'Widget10', 
@in13 = 'Widget11', @in14 = 'Widget12', @in15 = 'Widget13', @in16 = 'Widget14', 
@in17 = 'Widget15', @in18 = 'Widget16', @in19 = 'Widget17', @in20 = 'Widget18', 
@in21 = 'DWidget19', @in22 = 'Widget20', @in23 = 'Widget21', @in24 = 'Widget22', 
@in25 = 'Widget23', @in26 = 'Widget24', @in27 = 'Widget25', @in28 = 'Widget26', 
@in29 = 'Widget27', @in30 = 'Widget28', @in31 = 'Widget29', @in32 = 'Widget30', 
@in33 = 'Widget31', @in34 = 'Widget32', @in35 = 'Widget33', @in36 = 'Widget34', 
@in37 = 'Widget35', @in38 = 'Widget36'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:08:22+00:00Added an answer on May 12, 2026 at 4:08 pm

    If you have to ask this question, you should probably use a temp table. Insert your parameters to the temp table and either JOIN your main table to it, or use an IN() predicate against a subquery of the temp table.

    In most cases when you have 30+ parameters in an IN() predicate, you’re going to find that you need more periodically. Using a temp table allows you to keep increasing the number of values without having to rewrite your query.

    And it avoids any possibility of hitting a limit of the number of parameters or a limit on query length.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Sql Server db that was generated by Nhibernate's schema tool and
Think I have an integer array like this: a[0]=60; a[1]=321; a[2]=5; now I want
I think I have a basic understanding of this, but am hoping that someone
I think this could be a very easy question for you. But I have
I currently have a listing of data that has a randomly generated order listing.
I was wondering if anyone could think of a reason why two freshly-installed Firefox
I have a load balancer with some web servers behind it. The traffic hitting
I think I'm missing something very simple. I have a byte array holding deflated
I have an entry in my servlet.xml , xmlns:dwr=http://www.directwebremoting.org/schema/spring-dwr Now, what I think is,
I have run into an interesting limit with the App Engine datastore. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.