Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sriksdave
Starting Member
5 Posts |
Posted - 2007-03-22 : 01:43:48
|
<b>[DBNETLIB] Specified SQL Server Not Found</b>I am trying to execute sql scripts on the sql server 2000 on a remote machine in the networkI get this error when I try to Disable the old sql agent jobs and when I try to Grant Permissions to stored procs for a specific user.Can any one of you guys check the syntaxHere are the scripts<b>DISABLE JOB SCRIPT</b>USE DATABASENAMEGODECLARE @JobID BINARY(16)SELECT @JobID = job_id from msdb.dbo.sysjobswhere (name = 'JOBNAME')IF (@JobID IS NOT NULL)BEGIN EXECUTE msdb.dbo.sp_update_job @job_name = 'JOBNAME', @enabled = 0ENDSELECT @JobID = job_id from msdb.dbo.sysjobswhere (name = 'JOBNAME')IF (@JobID IS NOT NULL)BEGIN EXECUTE msdb.dbo.sp_update_job @job_name = 'JOBNAME', @enabled = 0END<B> GRANT PERMISSIONS SCRIPT </B>USE DATABASENAMEGOGRANT CREATE TABLE TO TABLENAMEGOGRANT EXECUTE ON STOREDPROC1 TO ROLENAMEGOGRANT EXECUTE ON STOREDPROC2 TO ROLENAMEGOGRANT EXECUTE ON STOREDPROC3 TO ROLENAMEGOCan anyone tell me if there are any errors in the syntaxThanks |
|
krishnarajeesh
Yak Posting Veteran
67 Posts |
Posted - 2007-03-22 : 02:42:59
|
Hi Pls see the code below. May be this will solve your problem.USE DATABASENAMEGODECLARE @JobID BINARY(16)SELECT @JobID = job_id from msdb.dbo.sysjobswhere (name = 'JOBNAME')IF (@JobID IS NOT NULL)BEGINexecute sp_addlinkedserver "10.201.80.222" --(Server IP)EXECUTE "10.201.80.222".msdb.dbo.sp_update_job @job_name = 'JOBNAME', @enabled = 0ENDThanks & Best Regards,Krishna |
 |
|
|
|
|