How to fix The number of row value expressions in the INSERT statement exceeds the maximum allowed number of 1000 row values.

Rabia Kurnaz 386 Reputation points
2023-06-15T08:41:02.9533333+00:00

How to fix The number of row value expressions in the INSERT statement exceeds the maximum allowed number of 1000 row values.

Azure SQL Database
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,702 questions
SQL Server Migration Assistant
SQL Server Migration Assistant
A Microsoft tool designed to automate database migration to SQL Server from Access, DB2, MySQL, Oracle, and SAP ASE.
568 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,344 questions
SQL Server Other
{count} votes

Accepted answer
  1. Viorel 122.6K Reputation points
    2023-06-15T18:37:18.1766667+00:00

    Try to split the statement. For example, replace

    insert Table1 values
    ( 1, 2, 3 ),
    ( 4, 5, 6 ),
    ( 7, 8, 9 )
    

    with

    insert Table1 values
    ( 1, 2, 3 ),
    ( 4, 5, 6 )
    insert Table1 values
    ( 7, 8, 9 )
    

    Each fragment should not exceed the maximum allowed number of 1000 row values.

    2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2023-06-16T01:46:27.6466667+00:00

    Hi @Rabia Kurnaz

    Or you can try the workaround mentioned in this thread.

    https://stackoverflow.com/questions/7737472/how-can-i-insert-100000-rows-in-sql-server

    Best regards,

    Percy Tang


    If the answer is the right solution, please click "Accept Answer". If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Olaf Helper 47,436 Reputation points
    2023-06-16T04:48:42.9533333+00:00

    The number of row value expressions

    You provide very lerss informations and so we have to guess:

    You have an INSERT statement with a lot of fix VALUE in the manner of

    INSERT INTO yourTable (Column1)
    VALUES (1), (2), (3), ..
    
    

    exceeds the maximum allowed number of 1000 row values.

    The do what the error imply, reduce the count of values and split the INSERT statement into several ones.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.