Friday, February 17, 2017

Cannot execute script: Insufficient memory to continue the execution of the program

                             Recently i have faced this error when i am trying to execute large insert script file with SQL Management Studio. Sometimes, due to the heavy size of the script and data, we encounter this type of error. Server needs sufficient memory to execute and give the result.There are two possible options you can try to resolve

Option #1:

  •  Open cmd.exe as Administrator.
  •  Create Documents directory.
  •  Put your SQL Script file(script.sql) in the documents folder.
  • Type query with sqlcmd, server-name, database-name and script-file-name as like above highlighted query or below command line screen.

sqlcmd -S server-name -d database-name -i script.sql

You can also simply increase the Maximum Server Memory value in server properties. To edit this setting, right click on server name and select Properties > Memory tab.