执行 SQL Server 脚本 [英] Execute SQL Server scripts
本文介绍了执行 SQL Server 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何自动运行给定文件夹中的所有 SQL 脚本?
How can I automate process of running all SQL scripts from given folder ?
推荐答案
编写 Windows 脚本,使用 FOR 构造循环遍历您的文件并使用 SQLCMD 实用程序来执行每个文件.
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
这篇关于执行 SQL Server 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文