1

I have a database that I need to connect to and select from. I have an SQL Login, let's call it myusername. When I use the following, no SELECT permission shows up:

SELECT * FROM fn_my_permissions ('dbo.mytable', 'OBJECT')
GO

Several times I tried things like:

USE mydatabase
GO

GRANT SELECT TO myusername
GO

GRANT SELECT ON DATABASE::mydatabase TO myusername
GO

GRANT SELECT ON mytable TO myusername
GO

It says the queries execute successfully, but there is never any difference in the first query. What simple thing am I missing to grant database level select permissions.

As a note, I made double sure it was the correct user, correct database, and I have already tried granting table level select permissions. So far I keep getting the error:

SELECT permission denied on object 'mytable', database 'mydatabase', schema 'dbo'.

Any ideas what I'm missing? Thanks in advance.

EDIT/UPDATE:

Upon right clicking the SQL User in SQL Server Management Studio 2008, I discovered every single Database role is checked, including db_denydatareader and db_datareader... might this be blocking my ability to grant permission at the database level? If this is so, what is the purpose of db_denydatareader? It seems silly to me to have a 'DENY' that can't be viewed when querying permissions.

SUMMARY: Sure enough, that fixed it.

2
  • You should post your EDIT/UPDate as the accepted answer =)
    – ajdams
    Commented May 25, 2010 at 21:25
  • You need your dba to fix your permissions.
    – HLGEM
    Commented May 25, 2010 at 21:27

2 Answers 2

3

In SSMS - under Databases-->mydatabase-->Security-->Users-->myusername, right click the username, select properties. Under database role membership, make sure db_denydatareader is not checked as this will override whatever permissions you had granted.

Knew it was something simple. :)

0

Have you tried reconnecting with that SQL user account?

Not the answer you're looking for? Browse other questions tagged or ask your own question.