Script SQL Database Permissions for database refresh

Do you restore SQL databases across SQL instances? The Database administrators get frequent requests to refresh the staging or development database from the production database. In this case, you need to script out DB permission on the development or staging database so that you retain existing permissions after restoration.

Take the script from GitHub and execute the script on the target database before the SQL database refresh, and it returns the existing permissions and their T-SQL script that you can apply after restoring a database.

The sample output of the DB script in my demo environment is as below

44 views0 comments