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.

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

Leave a Reply to guy Cancel reply

Your email address will not be published. Required fields are marked *