Need new Role supporting other roles....

  • I want to create a sql 7 database role, called Dev, that allows its members to have "db_datareader" and "db_datawriter" database roles for all tables in the database. (I prefer not to have to assign

    each user these roles on a table-by-table basis.) How can I do this?

    TIA,

    Bill

  • User-defined database roles can be nested. This means you can create your role and then make that role a member of other roles, to include fixed database roles. For instance:

    
    
    EXEC sp_addrole 'MyNewRole'
    EXEC sp_addrolemember 'db_datareader', 'MyNewRole'
    EXEC sp_addrolemember 'db_datawriter', 'MyNewRole'

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

Viewing 2 posts - 1 through 2 (of 2 total)

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