Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permissions issue in SSMS: "The SELECT permission was denied on the object 'extended_properties', database 'mssqlsystem_resource', ... Error 229)"

Tags:

Here’s the simplest repro case possible.

  1. Create a brand new database. (I'm using SQL 2005.)
  2. Create a login, a SQL user, and a table in the new database (see sample code below).
  3. Launch SSMS and open Object Explorer, logging in as the newly-created user.
  4. Attempt to open the "Tables" folder in the Object Explorer.

The Problem

Fails with this error message.

Message Text:

TITLE: Microsoft SQL Server Management Studio
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click: link
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
The SELECT permission was denied on the object 'extended_properties', database mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)
For help, click: link

This user can access the table and the record in the table. But the user cannot access the list of tables in Object Explorer.

SELECT USER_NAME() AS CurrentUser, col1 FROM dbo.TestTable  CurrentUser col1 ----------- ---- robg_test   1000 

The only work-around I have found is to give the user higher-than-necessary privileges (like db_datareader).

The Question:

What is the minimum privilege required to allow this user to open the table list in Object Explorer?

I have tried granting the user various privileges on the dbo schema, but that did not help.

Note also that I am using a SQL user simply to illustrate the problem. The original problem was with an AD user.

Here is a relatively similar question at serverfault.


Code

SET NOCOUNT ON USE master GO IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'robg_test')     DROP LOGIN [robg_test] GO CREATE LOGIN [robg_test] WITH     PASSWORD         = N'CLK63!!black',     DEFAULT_DATABASE = [RGTest],     DEFAULT_LANGUAGE = [us_english],     CHECK_EXPIRATION = OFF,     CHECK_POLICY     = ON GO  IF EXISTS (SELECT * FROM sys.databases WHERE name = 'RGTest')     DROP DATABASE [RGTest] GO CREATE DATABASE [RGTest] GO USE [RGTest] GO CREATE USER [robg_test] FOR LOGIN [robg_test] WITH DEFAULT_SCHEMA = [dbo] GO CREATE TABLE dbo.TestTable (col1 int) GO GRANT SELECT ON dbo.TestTable TO [robg_test] GO INSERT INTO dbo.TestTable VALUES (1000) GO 
like image 228
Rob Garrison Avatar asked Jan 04 '10 22:01

Rob Garrison


People also ask

How do you fix the Execute permission was denied on the object?

This can be done from SQL Management Studio or directly by SQL query: - Right click on the specific stored procedure, select Properties, go to Permissions page. Search for 'ComXClient' user and then select checkbox in Execute line and Grant column.

How do I fix create database permission denied in database master?

Step 2: Right click “Login” and select the user account under which you want to create the database. Step 3: Right click and select properties tab. Step 4: Under “Server Roles” tab, select “dbcreator” checkbox. Step 5: Click “OK” and try to create database in the user account.

How do I grant permissions in SQL Server Management Studio?

Using SQL Server Management StudioRight-click a stored procedure and select Properties. In the Stored Procedure Properties -stored_procedure_name dialog box, under select a page, select Permissions. Use this page to add users or roles to the stored procedure and specify the permissions those users or roles have.

How do I grant an object level permission in SQL Server?

Login to SQL Server Management Studio. In Object Explorer on the left pane, expand the Databases folder and select the concerned database and navigate to the by expanding Security and Users folders. Right-click the User to which you want to GRANT or REVOKE the permissions.


2 Answers

Please check that you didn't check db_denydatareader DB role. By removing that check it worked for me.

like image 75
Eltigani Avatar answered Sep 20 '22 17:09

Eltigani


I had similar problem and resolved that by removing two roles db_denydatareader and db_denydatawriter for that user and add other roles. I used sql management studio.

like image 40
Cool Man Avatar answered Sep 19 '22 17:09

Cool Man