Db_datareader role

  • How do I deny all the members of db_datareader role from viewing a column of a user table?

    If yes, can i achieve this with a script?

  • You cannot deny or revoke permissions to special roles. Db_datareader happens to be a special role.

    You can make a workaround by creating a new database role <Role1> and adding this new role to the db_datareader role. Add users to <Role1> and

    DENY SELECT ON

    database.schema.table(column)

    TO <Role1>

    ______________________________________________________________________________________________
    Forum posting etiquette.[/url] Get your answers faster.

  • Thanks Calvo.

    Is it possible to rename a custom db role?

  • Going out on a limb here and will say no.

  • Misread the question, read it that the OP wanted to rename db_datareader.

  • Thanks Steve.

  • Is it possible to move all the users(both windows and sql authnticated) from one database role to another using a script? In my case it would be from db_datareader to a newly created role.

  • You cannot rename fixed roles (provided by SQL Server), as Lynn noted.

    For custom roles, if you want to move people from db_datareader, you can query the role to find members.

    EXEC sp_helprolemember 'db_datareader';

    Use a table of some sort to store these names, and then you can read through them, running sp_addrolemember to add them to the new role.

  • Thanks Steve, that answers all my questions.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply