We are mostly creating the SQL job and schedule it to run automated. But sometime as per requirement, we need to invoke and run on demand basis, not on a schedule basis. I have done the same thing and the following is the smallest demo ready for you. Let's create one stored procedure and schedule in the job. USE [Master] GO CREATE PROCEDURE JobInvokeProc AS BEGIN SET NOCOUNT ON WAITFOR DELAY '00:00:15'; END GO Now we will create the job for the same and execute this stored procedure in the job. The created script for the job is as follows, USE [msdb] GO /****** Object: Job [Start_JobInvokeProc] Script Date: 05/05/2011 07:51:53 ******/ BEGIN TRANSACTION DECLARE @ReturnCode INT SELECT @ReturnCode = 0 /****** Object: JobCategory [[Uncategorized (Local)]]] Script Date: 05/05/2011 07:51:53 ******/ IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'[Uncategorized (Local)]' AND category_class=1) BEGIN EXEC @ReturnCode = msdb.dbo.sp_add_cate
Towards the innovative SQL ideas