The %ls permission was denied on the object ‘%.*ls’, database ‘%.*ls’, schema ‘%.*ls’.

Error Message:
Msg 229, Level 14, State 5, Line 1
The %ls permission was denied on the object ‘%.*ls’, database ‘%.*ls’, schema ‘%.*ls’.

Severity level:
14.

Description:
This error message appears when you try to execute an operation on a database object, but you do not have the appropriate permission to execute this operation.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity level 14 are generated by the user and can be fixed by the SQL Server user. The statement cannot be executed this way. Because of the missing permissions you cannot execute this operation. Contact your system administrator to discuss the permission issue.

Versions:
All versions of SQL Server.

Example(s):
USE Master;
GO
DROP LOGIN MyUser;
GO
CREATE LOGIN MyUser
  WITH PASSWORD = ‘abc’;
USE Northwind;
DROP USER MyUser;
CREATE USER MyUser FOR LOGIN MyUser
  WITH DEFAULT_SCHEMA = dbo;
GO
REVOKE SELECT ON OBJECT::dbo.Orders FROM MyUser;
GO
SETUSER ‘MyUser’
GO
SELECT *
  FROM dbo.Orders
SETUSER;

Remarks:
In the above example we first create a login and a user. The SELECT permission for the Orders table of the Northwind sample database is revoked from this user. Then we switch security context via the SETUSER command to the newly created user. The then executed SELECT statement against the Order table raises the error.




Related Articles :

  • No Related Articles Found

No comments yet... Be the first to leave a reply!

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |