Hi All!

I ran into an issue that I could not resolve for two days and, with the help of MS, it is finally resolved. It was enough of a thorn in my side that I thought I should post it online in hopes that it will help some resolve it a lot faster.

The error:

The server principal 'A' is not able to access the database 'B' under the current security context (Microsoft SQL Server, Error:916)

The issue:

This issue occurs with SQL Server 2008 RC0 tools.  Using SQL authentication, I could connect to database engine but I could not expand the ‘Databases’ node.  It would result in the error above.  The issue is with SQL Server Management Studio itself, not the database engine or any other aspect of SQL Server.  I could connect to the SQL installation from another server running SQL Server 2008 RC0, using SQL authentication, and expand the ‘Databases’ node without any errors.  But I couldn’t connect locally using SQL authentication.

In a nutshell:

Server A – While logged in locally on Server A, I could not connect and expand the ‘Databases’ node successfully using SQL authentication.

Server B – I could connect to the SQL instance on Server A and expand the ‘Databases’ node using SQL authentication successfully.

Based on my current understanding of the issue at hand, there are several work-a-rounds to correct this issue.  Hopefully, one of them will work for you.

Work around #1:

1. Within SQL Server Management Studio, view Object Explorer Details window by selecting View, Object Explorer Details in menu (or hitting F7)
2. Right-click on the column header and unselect 'Collation.'
3. Refresh the server in Object Explorer and enumerate the databases

Work around #2:

1. Within SQL Server Management Studio, view Object Explorer Details window by selecting View, Object Explorer Details in menu (or hitting F7)
2. In Object Explorer window click at Databases folder
3. In Object Explorer Details window right-click at the column header and select ‘Reset view’. 
4. Refresh Databases folder

Work around #3:

1. Check the database options for the “Auto Close” setting. If it is set to “True,” change it to “False” and test again.

Further explanation:

Collation for an offline database is returned as NULL by the engine, and SSMS currently interprets NULL values as a permissions issue.  The error will occur even if Object Explorer Details view is not open.  The same issue will occur if you try to enable a setting that you don't have permission to access on all databases, for example data space used.

Other helpful links:
• https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=355238
• http://sqlblog.com/blogs/aaron_bertrand/archive/2008/07/07/a-little-management-studio-oops.aspx
• https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=354322

I hope this helps!!

Written by Desiree Harris Employee @ SherWeb