是否可以让 SQLCMD 立即运行脚本中的每个语句而不使用“GO"? [英] Can you make SQLCMD immediately run each statement in a script without the use of "GO"?

查看:24
本文介绍了是否可以让 SQLCMD 立即运行脚本中的每个语句而不使用“GO"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SQLCMD 中运行脚本时,是否有设置、参数或任何其他方式使其在每个 SQL 语句的末尾有效地运行 GO 命令?

When running a script in SQLCMD, is there a setting, parameter or any other way of making it effectively run a GO command at the end of each SQL statement?

这将防止需要将周期性 GO 命令插入到非常大的脚本中.

This would prevent the need to insert periodic GO commands into very large scripts.

推荐答案

没有

SQLCMD 必须自己实现一个完整的 T-SQL 解析器,以确定语句边界在哪里.鉴于它目前存在,它所要做的就是找到带有GO"的行.

SQLCMD would have to implement a full T-SQL parser itself in order to determine where the statement boundaries are. Whereas as it currently exists, all it has to do is find lines with "GO" on them.

确定语句边界可能非常棘手,因为;"对于大多数语句,终止符仍然是可选的.

Determining statement boundaries can be quite tricky, given that ";" terminators are still optional for most statements.

这篇关于是否可以让 SQLCMD 立即运行脚本中的每个语句而不使用“GO"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆