Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


stevja01
2013-04-10T04:07:04Z
I need a way to run a SQL query on another server which saves data to a table, then select all the rows in the table and export them to a file (CSV or TXT) with headers and save the file to a directory that I can then pickup and email to support personnel.

I know how to connect to the server and run my SQL and pickup a file in a given directory and email it off; however I'm not sure of the best way to export the table contents on the server to an output file. When I run my SQL in VC it outputs the report to the interface now. I really need the info saved to a file that I can then manipulate based on the contents to make decisions on who to notify, what to do next.

Any suggestions?

Sponsor
Forum information
Support
2013-04-10T07:22:23Z
You can always do whatever you want with the previous output data using this Variable anywhere (for example in the File write Task):

{TASK(PrevTask,StdOut)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2013-04-10T13:18:38Z
I may not be doing this right, but here's what worked. Within the Write File task I used a variable that pulls the output from the specific task name (previous task) since when I tried to use the PrevTask argument it wouldn't work, said Job ID Not Found.

So within the Value: field I entered {(TASK(TaskID,StdOut)}
bbusse
2013-04-10T19:26:46Z
Originally Posted by: stevja01 

I may not be doing this right, but here's what worked. Within the Write File task I used a variable that pulls the output from the specific task name (previous task) since when I tried to use the PrevTask argument it wouldn't work, said Job ID Not Found.

So within the Value: field I entered {(TASK(TaskID,StdOut)}



As long as the Write File task is the VERY next task, after the one that contains the output, this variable should've worked: {TASK(PrevTask,StdOut)}

Thats the limit of PrevTask... it can't be out of order or another task in between.

Example:
Task With Output
Task using {TASK(PrevTask,StdOut)} for something

Can't be:
Task with Output
Some other task
Task using {TASK(PrevTask,StdOut)} for something


Brian


stevja01
2013-04-10T19:39:03Z
Hi Brian,
Yes it was the previous task for sure and I ran the job in order so not sure why it didn't work. So what I ended up doing was running my 42 SQL statements (each inserting data into a table), then a task to query (SELECT 😉 from the output table, then I used the Write Task to write the output from that specific task to a csv file. I still need to work on my 42 SQL tasks, there has to be a more efficient way to do that!! I have to run each query one at a time due to the performance hit to the back -end...but I think a SP or JOB has to be better, I just have to figure that out :)

-Jane
Scroll to Top