July 24, 2006 at 12:34 pm
I am using this to add a jobstep to an existing job. This step is to call a separate stored procedure that accepts two parameters. I am having trouble with the syntax for @additional_parameters. Here is my code. My @additional_parameters is obviously not correct.
EXEC msdb.dbo.sp_add_jobstep
@job_name = 'SampleJob',
@step_id = 1,
@step_name = 'SampleJob_Step1',
@subsystem = 'TSQL',
@command = 'EXEC DevDatabase.dbo.spProcess',
@additional_parameters = @id, @userId,
@database_name = 'DevDatabase'
Any help would be much appreciated!
MSSQL 2000
July 24, 2006 at 12:54 pm
@additional_parameters is going to need to be either on @parameter that is a concatenated string, or you will need to pass it in dynamically and read the two @parameter independently within the SP:
EXEC msdb.dbo.sp_add_jobstep
@job_name = 'SampleJob',
@step_id = 1,
@step_name = 'SampleJob_Step1',
@subsystem = 'TSQL',
@command = 'EXEC DevDatabase.dbo.spProcess',
@additional_parameters = "@id, @userId",
@database_name = 'DevDatabase'
I wasn't born stupid - I had to study.
July 24, 2006 at 1:49 pm
CHAR(33) is an exclamation point. You can use CHAR(34) double quotes or CHAR(39) single quotes... But you will still probably need something within you SP to seperate out those @Parameters, (is my guess...)
I wasn't born stupid - I had to study.
July 24, 2006 at 2:45 pm
All great points and I greatly appreciate it! I ended up using, "@command = @commandValue," and setting the @commandValue to include the exec and parameters together:
Set @commandValue = "EXEC DevDatabase.dbo.spProcess '" + @id + "', '" + @userId + "'" .
Hopefully that is appropriate, but it works perfectly from what I can tell.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy