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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I run ASP Code in SQL Job Scheduler?

Status
Not open for further replies.

cvasquez

MIS
Joined
Feb 28, 2001
Messages
88
Location
US
Under SQL Server Agent Job, I currently I have a file xxx.js and inside the command window I start with wscript [d:/location-nameoffile].

I tried to run this file also from the DOS prompt and I am getting an error on this line:
var fso = Server.CreateObject("Scripting.FileSystemObject");

It tells me that Server is an undefine name.
What should I do and how should I run this code if is done different. I am running SQL Server 7.
This code works fine if I run it from an ASP page.
I believe maybe that I using the wrong command to call this asp page. (WSCRIPT).

It is really a script file but with ASP code in it. I am not too familiar with VBScript I am currently a JavaScript guy.

All your help will be greatly appreciated.

Thanks.

Carlo.
 
VBScript is VB stripped down and renamed ASP.
I havent tried to run a script from a DOS prompt probably because the command processor WSCRIPT? doesnt know COM.
THE ASP environment does know the CREATE verb.

Easiest way to do this:
Create a DTS package with a single ActiveX Task and schedule that.

( for help)
 
Create an ActiveX task in DTS and use JScript. DTS supports both Java Script and VBScript ...
 
Actually, WScript does know COM. I use both everyday. It's a great way to do automated application builds.

What you need to do is change Server.CreateObject() to just CreateObject(). Server is an ASP object and only works in ASP.

Chris.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top