Execute SQL Server scripts

后端 未结 4 1456
余生分开走
余生分开走 2021-01-05 23:23

How can I automate process of running all SQL scripts from given folder ?

4条回答
  •  暖寄归人
    2021-01-05 23:59

    Write a Windows script, use the FOR construct to loop through your files and use the SQLCMD utility to execute each file.

    for %f in (c:\MySQLScripts\*.sql) do sqlcmd -i %f
    

提交回复
热议问题