Search code examples
sql-server-2008ssasssms

SSMS Change Connection for Query Editor Window


Normally when I want to change the connection for a Query Editor Window in SQL Server Management Studio, I can select a new connection from the menus at the top - Query > Connection > Change Connection.

However, when I am working on cubes with an analysis services connection - and then open a saved SQL script (such as the underlying SQL view) the Available Databases combobox is blank, and the "Change Connection" and other 3 options in that menu (Connect, Disconnect, Disconnect all queries) are all greyed out.

The only workaround I have found to be able to run the saved SQL script, is to open a "New Query" from the SQL Database I want to access in the Object Explorer, and either copy my script into it, or reopen the script - which now opens as normal, with the new query's database.

It seems to be taking the last Query Editor Window's database connection as the default connection for any new queries - and when your last "query" is browsing a cube then it breaks? Does anyone have a fix to un-grey out the "Change Connection" option properly?

I am using SQL Server 2008 R2, and opening the saved SQL script by the File > Open > File menu


Solution

  • Well, SSMS does not allow to manage connections easily (particulary, when you want to switch connections between servers). I have developed add-in for SSMS: SSMSBoost - it adds additional combobox to the toolbar with your favorite connections (you have to define them). In your case, after opening the script you will have to pick the right connection from this new combobox and it will be established. Addin is currently free.