Reputation: 105
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.
Upvotes: 1
Views: 3915
Reputation: 33914
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:
sqlcmd –S server –U username –P password -i MyFile.sql
Upvotes: 2
Reputation: 162
Try this
@echo Server: %1
@echo Database: %2
@echo User: %3
@echo Password: %4
set ISQLCMD=SQLCMD -S %1 -d %2 -U %3 -P %4 -m1 -i
Upvotes: -1
Reputation: 14865
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.
Upvotes: 1