views:

21

answers:

2

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.

+2  A: 

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.

Mitchel Sellers
+1 - SQL query language and SSMS have a one-way relationship - SSMS can tell SQL what to do, not the other way around.
JNK
@jnk `GO` is an SSMS directive - so it's not unreasonable to think that there could be others.. Although it looks like there actually aren't :P
Blorgbeard
+1  A: 

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

Tutorial: sqlcmd Utility
Using SQL Server 2005 sqlcmd Utility

KM
I'll definitely look into that alternative.
Blorgbeard