Scripting SQL Server permissions

前端 未结 9 1951
轮回少年
轮回少年 2021-01-30 02:58

I want to copy all the permission I\'ve set on stored procedures and other stuff from my development database to my production database. It\'s incredibly cumbersome, not to ment

9条回答
  •  一生所求
    2021-01-30 03:36

    You can get SQL Server Management Studio to do it for you:

    • Right click the database you want to export permissions for
    • Select 'Tasks' then 'Generate Scripts...'
    • Confirm the database you're scripting
    • Set the following scripting options:
      • Script Create: FALSE
      • Script Object-Level Permissions: TRUE
    • Select the object types whose permission you want to script
    • Select the objects whose permission you want to script
    • Select where you want the script produced

    This will produce a script to set permissions for all selected objects but suppresses the object scripts themselves.

    This is based on the dialog for MS SQL 2008 with all other scripting options unchanged from install defaults.

提交回复
热议问题