Run SQL script via command line

When a SQL file is too big to copy/paste it in your SQL Management Studio (getting a timeout error or such), you can use the command line, as follows:

sqlcmd -S myServer\instanceName -i C:\myScript.sql -o C:\log.txt

Leave a Reply

Your email address will not be published. Required fields are marked *