Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Tuesday, October 11, 2011

Grant Execute Access to all Stored Procs

When setting up a new user for a .NET website, the user often needs execute rights on stored procedures.  The easiest way to do this is the following SQL command:

/* CREATE A NEW ROLE */
CREATE ROLE db_executor

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

After that, just set your new user account up to be in the "db_executor" role for the database they need execute permissions on.

SQL Find Text

If you need to find text in a SQL stored procedure or function, the following query is helpful:

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%[InsertTextHere]%'