Sometimes it can be happen you have a very large sql script file to execute on your db and the the SQL Managemet Studio cannot handle it, giving you some RAM/memory error. Solution? Executing the script from the command line. How? Here we go!

The command is:

 sqlcmd -S IS-SERVER_SQL\MyInstance -U userName -P 123456 -i "C:\MyPath\script.sql" 

The sqlcmd command can execute sql script from the command line. The used parameters are:

  • -S: the instance name;
  • -U: username to access the instance;
  • -P: password of the user U;
  • -i: path of the script file to execute.

For more info about this command and to see all its parameters, click here.

 

Advertisements