views:

772

answers:

3

I am trying to restore database data using the following command from a large .sql file

"Type myfile.sql | sqlsmd –S server –U username –P password"

I get the following error:

Sqlcmd: Error: Scripting error.

I am unable to open the file, there is not enough memory.

+1  A: 

you could try using isql which has a -i input file option - that loses the nasty

Type myfile.sql |

You don't say which version of Sql you're using, but you could probably run your file in using DTS/SSIS, if you go with that approach you'll be able to turn on logging and actually see which line(s) fail, and set a threshold for an acceptable number of failing lines.

Another way is to use management studio to open the file and then execute it.

MrTelly
A: 
Atul
+1  A: 

SQLCMD has a "-i" inputfile parameter as well - I'd recommend using that. "Type"-ing the file and piping your output into SQLCMD is a hackish way to run the file, especially when the command line includes native support for reading from a file. Try this:

sqlsmd –S server –U username –P password -i MyFile.sql
rwmnau