The SELECT permission was denied on the object 'Address', database 'CNET_85731', schema 'dbo'

后端 未结 6 1819
夕颜
夕颜 2020-12-29 23:06

I have been working away for the last 7 months on a C# ASP.NET using Visual Studio 2008 and SQL Server 2008.

Today, I was running part of my application which was pr

6条回答
  •  星月不相逢
    2020-12-29 23:29

    Had a quick google, found this link Link

    It suggests running

    select object_name(major_id) as object,
     user_name(grantee_principal_id) as grantee,
     user_name(grantor_principal_id) as grantor,
     permission_name,
     state_desc
    from sys.database_permissions
     where major_id = object_id('Users')
     and class = 1
    

    On your database to see what permissions exist, as you may have a DENY select

    Edit

    select object_name(major_id) as object,
     user_name(grantee_principal_id) as grantee,
     user_name(grantor_principal_id) as grantor,
     permission_name,
     state_desc
    from sys.database_permissions
     WHERE state_desc = 'DENY'
    

    Managed to find a running SQL 2k8 box, and ran it, this new query will show all the deny's. Also try taking the WHERE clause out, to see all the permissions on all tables in the currently selected Database

提交回复
热议问题