|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, September 21, 2009 7:34 AM
Points: 17,
Visits: 21
|
|
| 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.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 12:43 PM
Points: 1,148,
Visits: 3,148
|
|
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
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Friday, June 08, 2012 12:30 AM
Points: 150,
Visits: 3,892
|
|
If your pretty sure this procedure is not needed anymore and it is a security risk, you probably should drop it:
DROP PROCEDURE [ProcedureName]
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, April 19, 2012 10:25 PM
Points: 1,231,
Visits: 3,483
|
|
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
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Friday, June 08, 2012 12:30 AM
Points: 150,
Visits: 3,892
|
|
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
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, September 21, 2009 7:34 AM
Points: 17,
Visits: 21
|
|
| I ran the alter procedure and it worked very well for us. Thank you for all of your help.
|
|
|
|