Could you suggest please how to create SQL Server Agent job for a stored procedure that have 1 input parameter?
The procedure is correctly created and i executed it using this code :
EXECUTE dbo.MYProcedure N'2016-02-25';
Is there a way to create a SQL Server Agent job for this procedure that have parameter ?
So i'm trying the basic way that is add this ligne in EXECUTE dbo.MYProcedure N'2016-02-25';
to the window of step in job
But the paraméter can change
here are the steps
Now save it and it should be ready for running manually. If you do want to automate it then open the job by going into the job monitor under SQL Server Agent in SQL management studio and then click on schedule and provide when and how often you would like your job to run.
If you automating the date parameter then add this as your Transact SQL statement:
DECLARE @DATE DATETIME
--Trim out the time so the date is set to 2016/02/25
--and time changes to 00:00 get date will get todays
--date or the run date
SET @DATE = DATEADD(DD,0,DATEDIFF(DD,0,GETDATE()))
EXECUTE dbo.MYProcedure @DATE
Happy coding!!!