Posted By

hoffstein on 11/13/08


sql dos

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


DOS command to run all SQL scripts in a path

 / Published in: DOS Batch

This assumes that you have sqlcmd (comes with SQL Server client tools) installed and wish to execute every file ending in .sql within the given directory against the specified server and database using Windows Authentication.

  1. for %f in ("c:\path\to\dir\*.sql") do sqlcmd -S [SERVER_NAME] -d [DATABASE_NAME] -i "%f" -b

Report this snippet  

You need to login to post a comment.