Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Intermediate
May 3, 2018

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Enable SQL Server to Run Stored Procedures at Server Startup

In order to execute a Stored Procedure when SQL Server starts, you first need to enable scanning for Startup Procedures with the following code:

EXEC sys.sp_configure N'scan for startup procs', N'1'
GO
RECONFIGURE WITH OVERRIDE
GO

Once you have configured your server to run Stored Procedures on startup, you have to enable the desired Stored Procedure to run at startup:

USE master
GO
EXEC SP_PROCOPTION ProcToRunAtEachStartup, 'STARTUP', 'ON'
GO

Now, each time your server is started the above stored procedure (named ProcToRunAtEachStartup - you can name yours anything you like) will run.

Hannes du Preez
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date