# Database Discussions > MS SQL Server 7/MS SQL Server 2000 >  sp_start_job does not evaluate "@server_name" parameter

## Ricardo

We want to start a job remotely on another SQL7 server.

innocently we thought that should be no problem with sp_start_job.

We used the command listed below:

use msdb
go
EXEC sp_start_job @job_name=&#39;MyJobName&#39;, @server_name=&#39;blablabla&#39;

The strange thing is, that sp_start_job ignores the @server_name at all.

Even if we enter complete nonsense for @server_name the job gets started as long it is present on the local sqlserver instance. 
sp_start_job seems to search locally for the given job_name, only.
Consequently if we enter the remote server&#39;s name the job fails as the
jobname is not present on the local sqlserver.

Any ideas what&#39;s going wrong here.

Greetings from Mannheim, Germany
Ricardo

----------


## Karl

Hi Ricardo,

the @server_name parameter in this procedure refers to a target server, which you specify when you create the job.  If the job isn&#39;t targeted to any servers then it won&#39;t run.

You&#39;re right when you say that sp_start_job only looks locally for a given jobname - that&#39;s the way it was designed.  If you want to start a job on another server you would have to execute the sp_start_job procedure that resides in the msdb database on that server.  You can do this if you have a linked server, or if you make some other connection to that server.

Alternatively you could osql to that server using an xp_cmdshell.

Hope this helps,

Karl


------------
Ricardo at 4/30/01 5:52:43 AM

We want to start a job remotely on another SQL7 server.

innocently we thought that should be no problem with sp_start_job.

We used the command listed below:

use msdb
go
EXEC sp_start_job @job_name=&#39;MyJobName&#39;, @server_name=&#39;blablabla&#39;

The strange thing is, that sp_start_job ignores the @server_name at all.

Even if we enter complete nonsense for @server_name the job gets started as long it is present on the local sqlserver instance. 
sp_start_job seems to search locally for the given job_name, only.
Consequently if we enter the remote server&#39;s name the job fails as the
jobname is not present on the local sqlserver.

Any ideas what&#39;s going wrong here.

Greetings from Mannheim, Germany
Ricardo

----------


## Ricardo

Hi Karl,

thank you for your help! By using your osql tip
we now have a working system.

Thanks again.
Ricardo


------------
Karl at 4/30/01 8:04:44 AM

Hi Ricardo,

the @server_name parameter in this procedure refers to a target server, which you specify when you create the job.  If the job isn&#39;t targeted to any servers then it won&#39;t run.

You&#39;re right when you say that sp_start_job only looks locally for a given jobname - that&#39;s the way it was designed.  If you want to start a job on another server you would have to execute the sp_start_job procedure that resides in the msdb database on that server.  You can do this if you have a linked server, or if you make some other connection to that server.

Alternatively you could osql to that server using an xp_cmdshell.

Hope this helps,

Karl


------------
Ricardo at 4/30/01 5:52:43 AM

We want to start a job remotely on another SQL7 server.

innocently we thought that should be no problem with sp_start_job.

We used the command listed below:

use msdb
go
EXEC sp_start_job @job_name=&#39;MyJobName&#39;, @server_name=&#39;blablabla&#39;

The strange thing is, that sp_start_job ignores the @server_name at all.

Even if we enter complete nonsense for @server_name the job gets started as long it is present on the local sqlserver instance. 
sp_start_job seems to search locally for the given job_name, only.
Consequently if we enter the remote server&#39;s name the job fails as the
jobname is not present on the local sqlserver.

Any ideas what&#39;s going wrong here.

Greetings from Mannheim, Germany
Ricardo

----------

