Msg 297 Level 16 State 1 Line 1 – SQLSERVERLEARNER https://sqlserverlearner.com LEARN SQL SERVER ONLINE Tue, 29 May 2012 08:54:40 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 Msg 297, Level 16, State 1, Line 1 The user does not have permission to perform this action. https://sqlserverlearner.com/2012/05/29/msg-297-level-16-state-1-line-1-the-user-does-not-have-permission-to-perform-this-action/ https://sqlserverlearner.com/2012/05/29/msg-297-level-16-state-1-line-1-the-user-does-not-have-permission-to-perform-this-action/#comments Tue, 29 May 2012 08:54:40 +0000 https://sqlserverlearner.azurewebsites.net/2012/05/29/msg-297-level-16-state-1-line-1-the-user-does-not-have-permission-to-perform-this-action/ Error Message:

Msg 297, Level 16, State 1, Line 1
The user does not have permission to perform this action.

Reason:
This error occurs when the user does not have permission to execute a specific query.

Example:
Revoke view state permission to user
[sql]
REVOKE VIEW SERVER STATE TO user_name
[/sql]
You will get the error message 297 when you execute this query to fetch the index usage stats
[sql]
select * from sys.dm_db_index_usage_stats
[/sql]

Fix/Resolution:
Provide the required permissions to the user.
[sql]
GRANT VIEW SERVER STATE TO user_name
[/sql]
Note: replace user_name with the name of the user.

]]>
https://sqlserverlearner.com/2012/05/29/msg-297-level-16-state-1-line-1-the-user-does-not-have-permission-to-perform-this-action/feed/ 1