Can I get SSMS to switch to the Messages tab programatically?

泪湿孤枕 提交于 2019-12-10 20:08:15

问题


I'm writing a fairly long running script, which prints progress messages as it goes.

However, SQL Server Management Studio by default shows the resultset tab, not the messages tab, so the user will have to click the messages tab after starting the script to see the progress as it happens.

Is there a way for my script to tell SSMS to show the messages tab automatically?

I know SSMS will remove the resultset tab once the script is complete, since it doesn't generate any resultsets, but I want the messages tab shown immediately, not at the end.

I'm not looking for a setting within SSMS, since this script will not be run on my machine once released.


回答1:


There is not anything that you can include in your script to change the default behavior of the SSMS IDE, you might be able to handle it with a setting, but you noted that isn't a valid solution.




回答2:


you should forget about trying to do this in SSMS and use the sqlcmd utility

Tutorial: sqlcmd Utility
Using SQL Server 2005 sqlcmd Utility



来源:https://stackoverflow.com/questions/3813788/can-i-get-ssms-to-switch-to-the-messages-tab-programatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!