v.bartosh - Tuesday, December 19, 2017 2:15 AM
I suspect that you're generating a script that uses a RBAR stored procedure to insert data into tables and that you're generating an EXEC for every row you're trying to insert.
If that's what you're doing, try the following, instead. Whatever "system" you're using to generate the SQLCMD stuff, change that to generate a TAB delimited file and using BULK INSERT to load the data file into a table. Then, if you insist on continuing to use the RBAR stored procedure to input the data, just loop through the rows of the table to do it.
A much better thing to do would be to still create the TAB delimited file and BULK INSERT it into a table and then rewrite the RBAR stored procedure to do things in bulk, as well.
--Jeff Moden
Change is inevitable... Change for the better is not.