使用 SqlCmd 的 Powershell 调用表达式
当使用 Invoke-Expression
sqlcmd -i script.sql
时,它似乎只显示返回的前两行。
当我在查询分析器中运行脚本时,它返回:
(2 rows affected)
Changed database context to 'ShopStore'.
(5 rows affected)
Changed database context to 'ShopStore'.
但是从 PowerShell 我只得到:
(2 rows affected)
Changed database context to 'ShopStore'.
YET,整个事情正在运行,我可以通过处理结果来看到这一点。这是为什么呢?
When using Invoke-Expression
sqlcmd -i script.sql
it seems to only display the first 2 lines returned.
When I run in Query Analyser the script it returns:
(2 rows affected)
Changed database context to 'ShopStore'.
(5 rows affected)
Changed database context to 'ShopStore'.
However from PowerShell I only get:
(2 rows affected)
Changed database context to 'ShopStore'.
YET, the whole thing is being run, I can see this by playing with results. Why is this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 sqlcmd.exe 上的文档:
这可能就是你看到不同结果的原因吗?
From the docs on sqlcmd.exe:
Could this be why you're seeing different results??