Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing a URL Command in a Job

Status
Not open for further replies.

Calen

Programmer
Sep 19, 2002
26
0
0
US
Hi all,

I need to have a scheduled job shut down a web community, do a database backup & restore, and then restart it. Something like this:

Code:
COPY DATABASE...

[URL unfurl="true"]http://mydev/devmgr/CommStart.html?COMMUNITY=MyComm&ACTION=Stop[/URL]

RESTORE DATABASE...

[URL unfurl="true"]http://mydev/devmgr/CommStart.html?COMMUNITY=MyComm&ACTION=Start[/URL]

The
The URL command works fine in a browser, but I need to make this an overnight job that can run automatically. I've tried EXECUTE ("COUNT field incorrect or syntax error"), and xp_cmdshell ("'http:' is not recognized as an internal or external command, operable program or batch file. 'ACTION' is not recognized as an internal...etc.").

Can anyone tell me how to have SQL Server 2000 execute a URL?

Thanks to all,

Calen
 
Are you using a sql agent job? If so change the step type to Operating system command. Then try something like
Code:
"C:\Program Files\Internet Explorer\iexplore.exe" [URL unfurl="true"]http://mydev/devmgr/CommStart.html?COMMUNITY=MyComm&ACTION=Stop[/URL]
I'm not sure that will definitely work, there might be user permission problems when sql is running as localsystem but it's somewhere to start.

Durkin
 
Thank you very much for replying, Durkin!

Yes, I'm trying to use a SQL Agent Job to do this.

I tried what you said, and every variation of it I could think of:
Code:
EXECUTE xp_cmdshell '"C:\Program Files\Internet Explorer\iexplore.exe [URL unfurl="true"]http://mydev/devmgr/CommStart.html?COMMUNITY=MyComm&ACTION=Stop"'[/URL]
Unfortunately, this was the output:
"'C:\Program' is not recognized as an internal or external command, operable program or batch file."


Can this be done with a call to xp_cmdshell? Another stored procedure, extended or not? Would I have more luck setting up a DTS Package to do this job and schedule that to run as a SQL Agent Job?


Thanks again,

Calen
 
You need to put quotes around "C:\Program Files\Internet Explorer\iexplore.exe" not the whole command because the path has spaces in it. Your URL doesn't have spaces so it doesn't need quotes around it.

Durkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top