How to start a SQL Server job programmatically/using TSQL/Scrip?


If you need to start a SQL Server job using TSQL immediately, follow below syntax:

USE msdb ;
GO
EXEC dbo.sp_start_job N'[Give the job name which needs to start]' ;
GO

This can be very useful if you use a stored procedure or script to start a job based on some business logic. For more options with this stored procedure, please refer to http://msdn.microsoft.com/en-us/library/ms186757.aspx

Comments