• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

Adding a VB 'Job' in SQL Enterprise Manager

Hi

I added a Job in Enterprise manager and this is the script

set FSO = server.createobject("Scripting.FileSystemObject")
set filewriter = FSO.createtextfile("d:/yourdirectory/yourfile.html")
filewriter.writeline "hello world"

set fso = nothing
set filewriter = nothing

And I set it to run every minute.

However
1 - nothing was created on my harddisk
2 - i cant seem to go back to edit or view the job?

thanks
0
paulwhelan
Asked:
paulwhelan
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
set FSO = server.createobject("Scripting.FileSystemObject")
set filewriter = FSO.createtextfile("d:/yourdirectory/yourfile.html")
filewriter.writeline "hello world"
filewriter.close
set fso = nothing
set filewriter = nothing

where is the drive D: (ie is it a local harddisk)
is the sql server local on your computer or on a remote server?

2) well, possibly you didn't create the job correctly, hence was not saved, hence did not run.

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
set filewriter = FSO.createtextfile("d:/yourdirectory/yourfile.html")

should also be:
set filewriter = FSO.createtextfile("d:\yourdirectory\yourfile.html")
0
 
[ fanpages ]IT Services ConsultantCommented:
See my comment in the related question:

"check if a website is 'live'"
[ http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21871271.html ]

===
Take your VBScript you pasted above & place it in a distinct file external to Enterprise Manager (and give it a ".vbs" extension).

Now set Enterprise Manager to run this .vbs file instead ("Execute Process Task" -> Set "Win32 Process" to be the full folder path/filename where you have saved the .vbs file).

Once you have this working we can look at re-coding the above suggestions in VBScript, rather than in VB(A) as they are shown in the previous comments.
===

BFN,

fp.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
paulwhelanAuthor Commented:
Hi fanpages

Where is "Execute Process Task"?
Should I do
Tools
Job Scheduling?

If I do that it gives me three options

TSQL command
Operating system shell command (eg run a batch script or invoke an application)
Active script (vbscript or javascript)

If I select Operation system shell command
it says
"type the Operating system shell command you want this job to execute"

What do I type here?

Thanks
Paul

0
 
paulwhelanAuthor Commented:
angel

Thanks
Im trying
set filewriter = FSO.createtextfile("d:\yourdirectory\yourfile.html")
now
So i will let you know

Also is there a way to view / edit old jobs?
I cant seem to find the ones i created
0
 
[ fanpages ]IT Services ConsultantCommented:
type the Operating system shell command you want this job to execute"

That's not where I meant, but this will work also.

Type in that field the full path/filename of the ".vbs" file you saved (from the above code).

"Execute Process Task" is an option within the Data Transformation Services tasks.

Sorry for not going into more detail... but I'm just in a rush to leave for an appointment.

Let me know how you get on, or whether angelIII's suggestion proves more useful.

BFN,

fp.
0
 
paulwhelanAuthor Commented:
angel
That didn't seem to work either
Would there be a simple insert i could do into my database instead of the 'write to d:'
thanks
paul
0
 
EDDYKTCommented:
set FSO = server.createobject("Scripting.FileSystemObject")

should it be


set FSO = wscript.createobject("Scripting.FileSystemObject")
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now