Monday, June 4, 2012

MICROSOFT SQL SERVER, ERROR: 916

To fix this SQL Server Management Studio 2008 bug please do the following:
  1. Open SQL Server Management Studio 2008
  2. Connect to the database server as normal
  3. Press F7 to open the "Object Explorer Details" window or click "View" >> "Object Explorer Details"
  4. In the object explorer details window expand by double click on "Databases"
  5. Right click on the header bar ("Name", "Policy health state", "Recovery Model", etc) and deselect "Collation" from the menu that will pop up
  6. From the object explorer, refresh the "Databases"
For those of you who connect to database servers where you are not in full control over all databases, or where some of your databases are ever offline (or auto-closed), the new version of Management Studio that is shipping with SQL Server 2008 is going to bring you some surprises, when you try to present a list of databases in Object Explorer.

It seems that the ability to do so is hinged upon the columns that are set up in Object Explorer Details by default.  In the case I came across yesterday, the offender was "Collation."  The problem is that for a database that is offline or has been auto-closed, collation comes back as NULL.  Well, that's not really the problem... the real problem is that SSMS throws its hands in the air when it comes across NULL for these values, and assumes this is NULL because you don't have permission.  So it throws up this error:
 
For those of you that connect to databases that are hosted by 3rd party providers, some of which are accustomed to leaving as many databases in auto-close mode as possible, you are first going to have to go to Object Explorer Details, right-click the column header list, and un-check Collation.  At this point, if you refresh the Databases node in Object Explorer, you should again see all of the databases on the server, even those where you don't have access.  Strangely enough, OED still shows you some other data by default, that it probably shouldn't (e.g. recovery model, last backup, owner).