对所有存储过程执行 GRANT EXECUTE

以下命令是否有效地授予用户MyUser"执行数据库中所有存储过程的权限?

Does the following command effectively give the user, "MyUser," permission to execute ALL stored procedures in the database?

GRANT EXECUTE TO [MyDomainMyUser]

推荐答案

SQL Server 2008 及更高版本:

SQL Server 2008 and Above:

/* CREATE A NEW ROLE */
CREATE ROLE db_executor

/* GRANT EXECUTE TO THE ROLE */
GRANT EXECUTE TO db_executor

仅针对用户(而非角色):

For just a user (not a role):

USE [DBName]
GO
GRANT EXECUTE TO [user]

相关文章