On-Start SQL

August 17, 2009

 On-Start SQL Server 2005

  • Auto starting a user stored procedure at SQL Server startup: sp_procoption: Sets stored procedure for autoexecution.
  • A stored procedure that is set to autoexecution runs every time an instance of SQL Server is started

sp_procoption ‘sp_QActivityLockedObjects’,’startup’,’true’

sp_procoption ‘ usp_OnSQLStart’,’startup’,’true’

  • To disable the SP from the SQL Server Startup

 sp_procoption ‘sp_QActivityLockedObjects’,’startup’,’false’

  •  To Check the SPs that run when SQL Server Starts, run the following query

 select name from master.dbo.sysobjects where type = ‘P’ and objectproperty(id, ‘ExecIsStartup’) = 1


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: