Tuesday, December 1, 2009

How to grant execute permission of all stored procedures to a user?

One recent request from our testers is that they need to execute all stored procedures on the testing database. And the simplest solution is to create a database role which is granted the execute privilege and add the testers' database users into this role.

Here it goes the script:

use [testing_db]
go
create role [testers]
go

grant exec to [testers]
go

exec sp_addrolemember N'testers', N'tester_db_user_account'
go


By running the above script, not only the execute rights of stored procedures, but also those of scalar functions are granted to the user.

Here are the two links that you might find interesting as well regarding this topic:
1 and 2.

No comments:

Post a Comment