Revoke All with T-SQL

  • I am setting up a role and I want to set all permissions to Revoke using T-SQL.

    Can you let me know how please

    Thanks

    Scott

  • Are you saying you want to setup the ROLE with REVOKE on all items, if so that is the default.

    If for accounts and other roles then you will use

    REVOKE ALL ON (itemtorevokeabilityon) FOR (accountorrole)

    You can use a cursor to loop thru each to handle.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • If you're just setting up the role, why would you need to revoke, there wouldnt be anything assigned to it anyway. If it already exists, it might be faster/easier to just write down the role members, remove them, drop the role, then add it back and add the users back. You can also update the system tables directly, though I recommend Antares solution as the best, mine as a hack.

    Just to be sure, are you wanting to deny rather than revoke?

    Andy

    http://qa.sqlservercentral.com/columnists/awarren/

  • Think your right...Deny is what I wanted, also the knowledge to programmatically change the status of the permissions on a 'global' scale, i.e. all of them, to the choice i make, maybe wanting all permissions to Grant etc.

    Thanks for your time again

    Scott

  • Look in SQL BOL at GRANT, REVOKE, and DENY. The syntax is there. I Showed REVOKE but full details on it's use are in Books Online.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • thanks very much for your time again...all sorted..ta

Viewing 6 posts - 1 through 5 (of 5 total)

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