some times you have to run a large SQL script in SQL server and “Sql Server Management Studio” dies when you load the large file.
To import / run the large script you need to use SQL Server command line tool sqlcmd
there are many parameters for this command line toll use this for full list
open command prompt and issue following command.
sqlcmd /?
Use following example command to execute a Large SQL Script.
sqlcmd -U MY_USER_NAME -P MY_PASSWORD -d DATABASE_NAME -i PATH_TO_SQL_FILE.sql -o PATH_TO_OUTPUT_FILE.txt
the above command will look like this for
user : sa
password : ok
database: mydatabase
script to import : script.sql
sqlcmd -U sa -P ok -d mydatabase -i d:\script.sql -o d:\MyOutput.txt
I hope this will help.
No Comments Yet