Memory exception when running only data script

When I run only script data in SQL Server 2008 R2, it shows this error:

Unable to execute script
Additional Information:
An exception of type "System.OutOfMemoryException" has been thrown. (Mscorlib)

The script file size is 115MB , and this is only data.

When I open this script file, it shows:

 Document contains one or more extremely long lines of text. These lines cause the editor to respond slowly when you open the file . Do you still want to open the file ? 

I run only the script schema, and then only for the script data.

Is there any way to fix this error?

+4
source share
3 answers

I solved this using sqlcmd utitlity.

 sqlcmd -S "Server\InstanceName" -U "instantName" -P "password" -i FilePathForScriptFile 

For instance:

 sqlcmd -S .\SQLEXPRESS -U sa -P 123 -i D:\myScript.sql 
+12
source

The answer to Zey was useful to me, but to complete:

If you want to use Windows Authentication, just omit the user and password.

And don't forget the quotation marks before and after the path if you have spaces.

 sqlcmd -S .\SQLEXPRESS -i "C:\Users\Stack Overflow\Desktop\script.sql" 
0
source

If you are logged on to the domain with the correct privileges and only one instance is running, you also do not need to specify the above arguments to the user / pw / instance command. I was able to simply execute:

sqlcmd -i myfile.sql

0
source

Source: https://habr.com/ru/post/1490655/


All Articles