Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Script out user defined database role permissions

Author  Topic 

ranvir_2k
Posting Yak Master

180 Posts

Posted - 2011-09-22 : 10:59:04
I have a user defined database role on one of my databases.

How can I script out the permissions that this role has?

jhnegrao
Yak Posting Veteran

81 Posts

Posted - 2011-09-22 : 17:00:34
Hello,

I suppose you are using SSMS 2008, so just click with the right button on the Database Role you want to script out and select "Script Database Role As", then select "CREATE to", then choose the option you preffer.

- New Query Editor
- File
- Clipboard.

Go to Top of Page

DaleTurley
Yak Posting Veteran

76 Posts

Posted - 2011-09-26 : 12:00:12
Use the sys.database_role_members and sys.database_permissions views to get database permissions.
Go to Top of Page

Peter99
Constraint Violating Yak Guru

498 Posts

Posted - 2011-09-26 : 13:49:45
jhnegrao, you cannot script permissions associated with role, method you specified.
Go to Top of Page

jhnegrao
Yak Posting Veteran

81 Posts

Posted - 2011-09-27 : 08:21:02
quote:
Originally posted by Peter99

jhnegrao, you cannot script permissions associated with role, method you specified.




Ok. Peter, sorry I misunderstood what our colleagues said...
But, Why don't you teach us how to do that?

Regards
Go to Top of Page

Peter99
Constraint Violating Yak Guru

498 Posts

Posted - 2011-09-27 : 11:40:57
I followed your method, there was no option to script permissions. I am also looking for method to script permissions associated with roles.
Go to Top of Page

jhnegrao
Yak Posting Veteran

81 Posts

Posted - 2011-09-27 : 13:16:35
Hello, Guys!

Please, take a look on this page
http://www.sql-server-performance.com/2002/object-permission-scripts/

I've never tested, but I think it gonna work.

Regards
Go to Top of Page
   

- Advertisement -