I generated script from old database, created a new database and imported all data from old database. So far so good, however, no user has execute rights for stored procedures. I know I can use
GRANT EXECUTE ON [storedProcName] TO [userName]
If it was just a few procedures, however, I have about 100 so what's the easiest way for me to grant execute access for a specific user to all of them?
Thanks in advance.
Without over-complicating the problem, to grant the EXECUTE on chosen database:
This is a solution that means that as you add new stored procedures to the schema, users can execute them without having to call grant execute on the new stored procedure:
Reference: Grant Execute Permission on All Stored Procedures
Create a role add this role to users, and then you can grant execute to all the routines in one shot to this role.
EDIT
This works in SQL Server 2005, I'm not sure about backward compatibility of this feature, I'm sure anything later than 2005 should be fine.
use below code , change proper database name and user name and then take that output and execute in SSMS. FOR SQL 2005 ABOVE