Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

sp_procoption (Transact-SQL)

Sets stored procedure for autoexecution. A stored procedure that is set to autoexecution runs every time an instance of SQL Server is started.

Topic link icon Transact-SQL Syntax Conventions

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

[ @ProcName = ] 'procedure'

Is the name of the procedure for which to set an option. procedure is nvarchar(776), with no default.

[ @OptionName = ] 'option'

Is the name of the option to set. The only value for option is startup.

[ @OptionValue = ] 'value'

Is whether to set the option on (true or on) or off (false or off). value is varchar(12), with no default.

0 (success) or error number (failure)

Startup procedures must be in the master database and cannot contain INPUT or OUTPUT parameters. Execution of the stored procedures starts when the master database is recovered at startup.

Requires membership in the sysadmin fixed server role.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft