roles, permissions, db_owner

  • Whats the difference between db_owner and public role...

    I want to create a role and add user to it..that user will have all the permissions on all the tables (our tables), all permissions on all stored procedures, triggers, views...that user is owner of all objects....right now we have to manually grant these permissions to each user, and I was think if I create a role I don't have to what happens with stored procedures and jobs ??

    Can some one help me the script to do this... am reading lots of articles about these but none have clear instructions...

    How do you create

    db_datareader, db_datawriter roles ??

    I cannot use EM as I have to send this script with our application..

    Thanks

    Sonali

  • db_owner has permission to do anything on a table while the public role has no permissions untill you assign them. You can create a role and assign permission to it, and then assign users that role. That way you only assign permissions once(to the role) I don't thing there is a tsql way to create a role but check books online. A lot of apps that I have worked on write scripts that assign permissions to the public role, since you know that it exists on any sql db.

  • So how do I add user to db_owner role ??

  • First off, I looked it up and there is a way to script adding a role:

    sp_addrole 'Professor'

    GO

    so to add to db_owner:

    sp_addrolemember db_owner, jsmith

    GO

    Its better not to make everyone owner. Create a role with the permissions that you want and assign that to the users.

Viewing 4 posts - 1 through 3 (of 3 total)

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