Search this blog

Monday, October 5, 2009

How to make a Stored Procedure to Automatic Execution?

You can use the sp_procoption system stored procedure to mark the stored procedure to automatic execution when the SQL Server will start. Only objects in the master database owned by DBO can have the startup setting changed and this option is restricted to objects that have no parameters.


Syntax:
sp_procoption [ @ProcName = ] 'procedure' 
    , [ @OptionName = ] 'option' 
    , [ @OptionValue = ] 'value'


Sample Code:
USE master
EXEC sp_procoption 'ClearTempFiles', 'startup', 'true') 

No comments:

Post a Comment