Geeky/Programming SQLServerPedia Syndication

SQL Server: sp_add_job – parameter passing

I am sure there are other SQL procedures that take parameters the same way, but I recently have been dealing with sp_add_job. You can call the procedure and pass in parameters

sp_add_job @job_name = ‘My Job Name’

for an example. cannot do this


SET @test = ‘ Test ‘

sp_add_job @job_name = ‘My Job Name’ + @test

You will get an error, because you cannot concatonate a string while passing it in as a parameter. What you need to do is this.


SET @test = ‘My Job Name Test’

sp_add_job @job_name = @test

* Note there are other params you need to pass to the procedure, but I just passed the one for example’s sake

Technorati Tags: ,,

By Steve Novoselac

Director of Digital Technology @TrekBikes, Father, Musician, Cyclist, Homebrewer

One reply on “SQL Server: sp_add_job – parameter passing”

Leave a Reply

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

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.