September 18, 2009 at 9:19 am
Our company has had many consultants come in over the last few years and apparently one of them wrote a stored procedure that hasn't been run since 06. How can I block access to keep anyone from running this stored procedure again.
September 18, 2009 at 9:37 am
cindy.hutchins (9/18/2009)
Our company has had many consultants come in over the last few years and apparently one of them wrote a stored procedure that hasn't been run since 06. How can I block access to keep anyone from running this stored procedure again.
i.e.
DENY EXECUTE,VIEW DEFINITION ON usp_MyProc TO SomeDatabaseRole
Tommy
Follow @sqlscribeSeptember 18, 2009 at 11:59 pm
If your pretty sure this procedure is not needed anymore and it is a security risk, you probably should drop it:
DROP PROCEDURE [ProcedureName]
September 19, 2009 at 12:18 am
More safe is making a return statement with desired messages in the SP,then only the users/sa/dba understand the causes.
ALTER PROCEDURE DBO.MYPROCEDURE
--
--
--
as
begin
begin
raiserror ('your message why its blocked to execute, any specific reason(s)',16,1)
return
END
--
--
--
END
September 19, 2009 at 12:24 am
I like arun.sas' suggestion. If you need to keep the code in the sproc, you could just add what arun.sas suggested to the top of the procedure thereby 1) preventing it from being executed; 2) retaining the code in case in needs to be utilized; 3) provides a useful error message if it is attempted to be executed.
Cheers,
Carleton
September 21, 2009 at 7:35 am
I ran the alter procedure and it worked very well for us. Thank you for all of your help.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply