Removing a startup stored procedure

In my combing through of the sql servers I found a startup stored procedure on one of the sql servers here. I didn’t recognize the tables it created or its name, so I asked around: no one else knew anything either. How to gracefully deal with this? Simply remove its startup property creates a timebomb. I decided to alert the production services manager, who gets all the issue emails, send what to do if there is a complaint and I am not available, and then drop what the procedure creates and hold my breath.

use tempdb
go
drop table <<table name>>
drop table <<table name>>
 
— remove it as a startup procedure
use master
go
exec sp_procoption @procname = ‘<<proc name>>’, @optionname = ‘startup’, @optionvalue = ‘false’
go
 
— shows that there are no startup procedures
select name from sysobjects where type = ‘p’ and OBJECTPROPERTY(id, ‘ExecIsStartup’) = 1

— So, if people complain, then run 
exec master..<<proc name>>
exec sp_procoption @procname = ‘<<proc name>>’, @optionname = ‘startup’, @optionvalue = ‘true’

This entry was posted in DBA. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *