Thursday, July 24, 2014

SQL Server: insufficient memory to continue the execution of the program (mscorlib)



When using large size SQL generated scripts to create/recreate databases, the above message is encountered.

To solve the issue, go to command prompt and issue the below command

c:\Program Files\Microsoft SQL Server\100\Tools\Binn> sqlcmd -S (LocalDb)\v11.0 -i D:\SQLDB\SqlserverScript.sql

Setting changes that you will need to do based on your environment

"c:\Program Files\Microsoft SQL Server\100\Tools\Binn" go to the folder where SQL server installed in your workstation

(LocalDb)\v11.0 - Replace this with your SQL server instance name

"D:\SQLDB\SqlserverScript.sql" - path to SQL script