Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

DBUser Roles Script

By Pradyothana Shastry,

This script will be used to script out the users and their permissions at the database level. We can use this when we are replacing /overrighting the existing database.

First we need to make sure we fill the following fields propertly.

>> Change the DB name in which you want to script roles 
SET @DBNAME='ReportingDatabase'
>>Change the Db name where you want to store the values
SET @STORAGEDBNAME='master'

>> Use below query , copy the output and run to re create those

select * from master.DBO.TEMP_TABLE_FOR_USERS

>> Note this will ovewrite the same table if we ran more than once

Total article views: 1744 | Views in the last 30 days: 1
 
Related Articles
FORUM

Monitoring script

script

FORUM

Script

Need Automated Script

FORUM

drop script

drop script

FORUM

Script component

Script component

Tags
 
Contribute