How to Insert 150,000 Rows in SQL Server Efficiently? (Error: Max 1000 Row Limit)
0
votes
3
answers
292
views
I am working with a large dataset of 150,000 rows that needs to be inserted into a SQL Server table. However, I am encountering the following error when trying to insert all values at once using a single **INSERT INTO ... VALUES** statement:
Msg 10738, Level 15, State 1, Line 1007
*The number of row value expressions in the INSERT statement exceeds the maximum allowed number of 1000 row values.*
**Question**:
1. What is the best way to efficiently insert 150,000 rows into SQL Server?
2. Should I use BULK INSERT, bcp, or an alternative approach?
3. Any performance considerations or best practices for handling large inserts like this?
Would appreciate any insights from experts who have dealt with large-scale data inserts in SQL Server.
I am thinking to add like this... Any suggestions are welcome!
INSERT INTO tableName (Column1, Column2, ...) VALUES
(value1, value2, ...),
(value3, value4, ...),
...
(value1000, value1001, ...); -- First batch
INSERT INTO tableName (Column1, Column2, ...) VALUES
(value1001, value1002, ...),
(value1003, value1004, ...),
...
(value2000, value2001, ...); -- Second batch
Thanks in advance!
Asked by Jamal Ashraf
(101 rep)
Mar 24, 2025, 11:37 AM
Last activity: Mar 25, 2025, 12:24 PM
Last activity: Mar 25, 2025, 12:24 PM