Hi folks,
I wanted to implement a policy at our workplace where users cannot submit a select query directly but should execute a procedure with the query text as parameter and the procedure in turn will execute the query. The users should be denied all rights except to execute this procedure.
The basic code of the proc is like this
declare sp_queryproc @sql_str varchar(8000)
as
execute (@sql_str)
The procedure will contain some more code to set transaction parameters and some other checks to validate whether to allow the query or not. However, it seems that it will not work - whenever execute is used in the procedure, it checks for the permissions of user invoking the procedure and not the user who has created the procedure. If instead of execute, I give a hardcoded select statement (say select * from sometable), it works fine.
Can someone suggest how we can overcome this. We are on SQL 7.0 and expect users to submit any kind of query through query analyzer.
Thanks
RT
RT
I wanted to implement a policy at our workplace where users cannot submit a select query directly but should execute a procedure with the query text as parameter and the procedure in turn will execute the query. The users should be denied all rights except to execute this procedure.
The basic code of the proc is like this
declare sp_queryproc @sql_str varchar(8000)
as
execute (@sql_str)
The procedure will contain some more code to set transaction parameters and some other checks to validate whether to allow the query or not. However, it seems that it will not work - whenever execute is used in the procedure, it checks for the permissions of user invoking the procedure and not the user who has created the procedure. If instead of execute, I give a hardcoded select statement (say select * from sometable), it works fine.
Can someone suggest how we can overcome this. We are on SQL 7.0 and expect users to submit any kind of query through query analyzer.
Thanks
RT
RT