Sep 30

Opening a SQL file against a multiserver query window with Windows authentication fails

One of the exciting new SQL Server 2008 features for those of us deploying SQL changes to multiple servers is the new Multiple Server Query Execution. We immediately found that opening a SQL file against a server group fails if you use Windows authentication to connect to your database servers. The query window shows that all connections are disconnected, and a login failure shows up on every SQL Server in the group.

Workaround: Open a blank query window, and paste in the contents of the SQL script you want to run.

If you’re blighted by this bug as well, please vote it up in Microsoft Connect.


Jul 13

This version of Microsoft SQL Management Studio can only be used to connect to SQL Server 2000 and SQL Server 2005 servers

Yes it can, provided that you have kept your 2005 installation up to date!

We’re in the process of upgrading our environment to SQL Server 2008. Some folks have been unable to install SSMS 2008 for various exciting reasons related to an inability to apply Visual Studio 2008 SP 1 (a documented Microsoft bug). This isn’t really a problem — you can use SSMS 2005 to connect to SQL Server 2008, you just won’t get the new SSMS features.

Occasionally, though, a particularly laggardly developer who is just now trying for the first time to connect to our development 2008 instance will email me a screencap of the following dialog box and testily inform me that it NOT TRUE that you can use 2005 to connect to 2008 (they’re fond of capslock, those developers).

The problem is on the workstation end — a failure to keep SSMS 2005 properly patched. Simply apply SQL Server 2005 SP 2 (it came out in 2007, for crying out loud!), and you’ll have no problems using SSMS 2005 to connect to SQL Server 2008.

Oct 18

Maintenance Plan Cleanup Tasks

My observations suggest that you can only add a maintenance cleanup task (to delete expired backups) from the machine on which SQL Server resides. When I run the maintenance plan wizard from SSMS on my own machine, I don’t get that option.

Once you successfully add a maintenance cleanup task, how do you get it to delete .bak, .dif and .trn files all in the same task? Leaving the extension box blank doesn’t result in anything getting deleted. The secret is to enter * as the extension. The period before the extension should be omitted.

Jul 19

SSMS: Keyboard shortcut for "change connection"

When deploying database code, I’m running each SQL script on several servers, and having to click the “change connection” button dozens of times in SSMS is very frustrating. I submitted this as a bug to Microsoft, and Bill Ramos offered the following method for creating a keyboard shortcut:

  1. Open a Query Editor window connected to your favorite server.
  2. Right click on the Change Connection toolbar button on the Query Toolbar button and select the Customize command at the bottom of the menu.
  3. Right click on Change Connection button again and then change the command name “C&hange Connection…” to “Chan&ge Connection…”. This will change the hot key from Alt-H (which would conflict with the Help menu hot key) to Alt-G.
  4. Finally, in the Right Click menu for the Change Connection button, you need to select the command option to display both “Image and Text”. This exposes the Alt-G command to the Query Editor.
  5. You can now close the Customize dialog and use Alt-G as your hot key!

I love this shortcut. I use it dozens of times daily. It’s still too much overhead for deploying, though, so I either use Query Analyzer (open a window, drag all the files into it, and they all open with a connection to that same server without prompting) or an application I wrote to accept a deploy list, get the files from our source control provider, and put them all into one script with appropriate USE [database] statements.