I have a database where all access is controlled by stored procedures. The database administrator would like to avoid giving users direct read / write access to the underlying tables that I can understand. Therefore, all updating and data selection is done using stored procedures. Basically, he created one role that has EXECUTE permissions for all stored procedures in the database and provided users with this role.
The problem is that one of the stored procedures dynamically builds an SQl query and executes it through "Execute sp_Executesql". Without going into details, the query is created dynamically, since it changes significantly depending on many user input parameters. The stored procedure in question is only a SELECT sql statement, however, I believe that simply providing the EXECUTE permission stored procedure is not enough. In the base tables referenced in the stored procedure using "Execute sp_Executesql", access to the "datareader" must be granted, otherwise the stored procedure will fail.
Any thoughts on how to fix this? I really wanted to restrict access to tables to only stored procedures, but I need to find a way around the stored procedures that use "Execute sp_Executesq" l. Thanks.
sql sql-server dynamic-sql permissions sp-executesql
webworm
source share