简体   繁体   中英

Transfer permissions from one domain to another in SQL Server

At the bottom of most of our stored procedures we have a grant similar to

GRANT EXECUTE ON [dbo].[uspFOO] TO [DOMAIN\SQLServerUsers]

Luckily for me, our domain is changing and we now need to go through and change the permissions. Does anyone know of an easy way to do this using the DB metadata so I can pull out all the places where [DOMAIN\\SQLServerUsers] is given permission to run and substitute it with [DOMAIN2\\SQLServerUsers]?

Thanks.

For those asking, this is on SQL Server 2005.

What version of SQL Server are you on??

In 2005 and up, you could

  • create a new database role "db_executor" and do

     GRANT EXECUTE TO db_executor 
  • grant that database role to all necessary users

This will create a "catch all" role that has execute rights on every existing and future (!!) stored proc in your database. Yes, that does include future stored procs, too! Very handy indeed (at least as long as every user is allowed to execute all stored procs)

That way, you don't have to create separate GRANT EXECUTE statements for each and every stored proc.......

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM