I reproduced the error below;
Issue 1:
Msg 916, Level 14, State 1, Line 1 The server principal "Test_Login" is not able to access the database "testdb" under the current security context. |
1. Created database ‘testdb’
2. Created the login ‘Test_Login’. The login not granted access on the database ‘testdb’
3. On logging on ‘Test_Login’, tried accesing the database ‘testdb’ and got the error.
From the error message, when the server principal ( login) does not have access on the database the error occurs.
Resolution 1:
Grant the database access for the login. For example;
Use testdb Create User Test_Login for Login Test_Login |
Issue 2:
The database is in “Restricted Mode”
Try the query below, to access the database in different user context
Use testdb |
Msg 916, Level 14, State 1, Line 1
The server principal "Test_Login" is not able to access the database "testdb" under the current security context.
Reference :
"The server principal LoginName is not able to access the database DatabaseName under the current security context"
No comments:
Post a Comment