14 Şubat 2019 Perşembe

Running large .sql script via command line

Sometimes we need to run large sql script which has 1-10 gb size or something etc. then we won't be open this .sql file in sql, notepad, etc.

In this case, we need to run this command without any problem in easiest way, we can use commandline sqlcmd command to run our sql commands.


To do this operation, just follow few steps ;
 - Click Windows + R
 - type cmd and press enter to reach commandline
 - use  sqlcmd -S [servername] -d [databasename] -i [scriptfilename] command to run your file :)

Thats all.

In my scenario , I runned 8 GB .sql file with this method then it will completed successfuly without wasting memory or cpu while doing its job.