Sets stored procedure for autoexecution. A stored procedure that is set to autoexecution runs every time an instance of SQL Server is started.
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 , with no default. nvarchar(776) [ @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 (
or true ) or off ( on or false ). off value is , with no default. varchar(12)
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 all databases are recovered and the "Recovery is completed" message is logged at startup.
Requires membership in the
sysadmin fixed server role.