This command executes the contents of your SQL script from a command line:
sqlcmd -S ServerName\InstanceName -d DatabaseName -i test.sql
This command iterates through every file in a given directory: (and just echoes it to standard out)
for /R %f IN (dir *.sql) DO echo %f
Put them together and you can execute all the scripts in a given directory:
for /R %f in (dir *.sql) DO sqlcmd -S ServerName\InstanceName -d DatabaseName -i %f
0 comments:
Post a Comment