Configure the scan for startup procs (server configuration option)
Applies to:
SQL Server
This topic describes how to configure the scan for startup procs server configuration option in SQL Server by using SQL Server Management Studio or Transact-SQL. Use the scan for startup procs option to scan for automatic execution of stored procedures at SQL Server startup time. If this option is set to 1, SQL Server scans for and runs all automatically run stored procedures that are defined on the server. The default value for scan for startup procs is 0 (do not scan).
In This Topic
Before you begin:
To configure the scan for startup procs option, using:
Follow Up: After you configure the scan for startup procs option
Before You Begin
Recommendations
This option is an advanced option and should be changed only by an experienced database administrator or certified SQL Server professional.
The value for this option can be set by using sp_configure; however, it will be set automatically if you use sp_procoption, which is used to mark or unmark automatically run stored procedures. When sp_procoption is used to mark the first stored procedure as an autoproc, this option is set automatically to a value of 1. When sp_procoption is used to unmark the last stored procedure as an autoproc, this option is automatically set to a value of 0. If you use sp_procoption to mark and unmark autoprocs, and if you always unmark autoprocs before dropping them, there is no need to set this option manually.
Security
Permissions
Execute permissions on sp_configure with no parameters or with only the first parameter are granted to all users by default. To execute sp_configure with both parameters to change a configuration option or to run the RECONFIGURE statement, a user must be granted the ALTER SETTINGS server-level permission. The ALTER SETTINGS permission is implicitly held by the sysadmin and serveradmin fixed server roles.
Using SQL Server Management Studio
To configure the scan for startup procs option
In Object Explorer, right-click a server and select Properties.
Click the Advanced node.
Under Miscellaneous, change the Scan for Startup Procs option to True or False by selecting the value you want from the drop-down list box.
Using Transact-SQL
To configure the scan for startup procs option
Connect to the Database Engine.
From the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute. This example shows how to use sp_configure to set the value of the
scan for startup procs
option to1
.
USE AdventureWorks2022;
GO
EXEC sp_configure 'show advanced options', 1 ;
GO
RECONFIGURE
GO
EXEC sp_configure 'scan for startup procs', 1 ;
GO
RECONFIGURE
GO
Follow Up: After you configure the scan for startup procs option
The server must be restarted before the setting can take effect.
See Also
RECONFIGURE (Transact-SQL)
Server Configuration Options (SQL Server)
sp_configure (Transact-SQL)
sp_procoption (Transact-SQL)