sp_procoption

Transact-SQL Reference

Transact-SQL Reference

sp_procoption

Sets procedure options.

Syntax

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

Arguments

[@ProcName =] 'procedure'

Is the name of the procedure for which to set or view 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, which sets stored procedure for autoexecution. A stored procedure that is set to autoexection runs every time Microsoft® SQL Server™ is started.

[@OptionValue =] 'value'

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

Return Code Values

0 (success) or error number (failure)

Permissions

Execute permissions default to members of the sysadmin fixed server roles. Startup procedures must be owned by the database owner in the master database.

See Also

OBJECTPROPERTY

System Stored Procedures