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 7503287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:10:19+00:00 2026-05-29T21:10:19+00:00

Unfortunately, SQL Server can not a handle a parameter list which exceeds 2100 parameters.

  • 0

Unfortunately, SQL Server can not a handle a parameter list which exceeds 2100 parameters. I have a couple of queries which when run in a batch mode exceed this limit. To still get the results I want and quickly cycle through the data set I have decided to make use of Skip(i).Take(2000) in a for loop.

What I was not prepared for was that both Union and Concat require an IEnumerable to be more than just instantiated to work. Sure it’s an empty, but I must be missing something fundamental about their use. At any rate, to solve the issue I ended up using a List and AddRange. I am making use of NHibernate, but don’t think that factors into why Union and Concat aren’t working.

var machineResults = new List<Machine>();

for (int i = 0; i < machines.Count(); i += 2000)
{
                   // I would have expected Union or Concat to work here
    machineResults.AddRange(GetSession().CreateQuery(
       @"select distinct m
        from Machine m
        where m in (:MachinesList)") // there's more criteria than this
       .SetParameterList("MachinesList",
                          machines.Skip(i).Take(2000).ToList())
       .List<Machine>());                
}

return machineResults;

So what am I missing about Union and Concat? Why don’t they work in the above statement? I understand why AddRange works, but what if I was concerned about the uniqueness of my results and wanted to use Union?

  • 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-29T21:10:23+00:00Added an answer on May 29, 2026 at 9:10 pm

    Union and Concat are pure methods. They do not modify the object they are run on, instead they return a copy.

    var a = new [] {1, 2, 3, 4};
    var b = new [] {5, 6, 7, 8};
    
    var c = a.concat(b);
    

    After this code has run

    a => [1, 2, 3, 4]
    b => [5, 6, 7, 8]
    c => [1, 2, 3, 4,5, 6, 7, 8]

    Meaning if you had machineResults.concat(x), you’re not actually modifying the machineResults collection. Instead you’d have to have machineResults = machineResults.concat(x).

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

Sidebar

Related Questions

Unfortunately we do not have the required DCOM access to the SQL Server mentioned
I have a database called MyDB in a Microsoft SQL Server 2008 Express instance
I have a SQL Server 2008 database with a large amount of varchar(max) data
We have some SQL server reporting services reports. I didn't write then but I
I am working on a product that runs an SQL server which allows some
Possible Duplicates: SQL Multiple Parameter Values SQL Server (2008) Pass ArrayList or String to
I'm helping implement a SQL Server 2008 database and I have several columns that
I'm using sql server 2005/2008 and I have a table that it's PK (rec_index)
I have a somewhat small database in SQL Server Express 2005 that I really
I have a local SQL Server Express database that I want to copy to

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.