We have the below requirement, A large text file of size 44GB containing insert scripts for a table is given. We need to execute these scripts against target SQL server 2008 R2 database. We followed 2 step process to execute the scripts. 1. Bulk inserted all the insert statements into intermeditate table one by one(approx 22 million records). 2. Then executed the statements in the intermediate table using a cursor.
The first step is succeeding, however the second step is not so effective as it is slow and a few insert statements fail in the middle of execution. We are unable to locate the exact point of failure. Could you please let us know an effective way of accomplishing the task.
preguntado el 31 de julio de 12 a las 12:07
Using a cursor is generally not recommended due to being slow and a memory hog. Try using a WHILE loop instead?
Ejemplo de referencia: