insert more than 1000 rows sql

Solutions on MaxInterview for insert more than 1000 rows sql by the best coders in the world

showing results for - "insert more than 1000 rows sql"
Marianna
03 Feb 2018
1BEGIN TRY
2BEGIN TRANSACTION
3-- Please enter 1000 rows for each insert
4INSERT INTO OFBC_MD20_CC_Values (Column1, Column2, Column3, Column4, Column5, Cloumn6, Column7)
5values('data1','data2','data3','data4','data5','data6','data7'),('data1','data2','data3','data4','data5','data6','data7')...   -- Till max 1000 rows
6INSERT INTO OFBC_MD20_CC_Values (Column1, Column2, Column3, Column4, Column5, Cloumn6, Column7)
7values('data1','data2','data3','data4','data5','data6','data7'),('data1','data2','data3','data4','data5','data6','data7')...... -- Till max 1000
8INSERT INTO OFta3','data4','data5','data6','dBC_MD20_CC_Values (Column1, Column2, Column3, Column4, Column5, Cloumn6, Column7)
9values('data1','data2','daata7'),('data1','data2','data3','data4','data5','data6','data7')...... -- Till max 1000
10......Many time as needed
11
12 
13
14COMMIT TRANSACTION
15END TRY
16BEGIN CATCH
17IF @@TRANCOUNT > 0
18ROLLBACK TRAN -- RollBack in case of Error
19
20DECLARE @ErrorMessage NVARCHAR(4000);
21DECLARE @ErrorSeverity INT;
22SELECT
23@ErrorMessage = ERROR_MESSAGE(),
24@ErrorSeverity = ERROR_SEVERITY();
25
26 
27
28-- you can Raise ERROR with RAISEERROR() Statement including the details of the exception
29THROW 51000, @ErrorMessage, 1
30END CATCH
similar questions
queries leading to this page
insert more than 1000 rows sql