Community forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Offline Librus Prime  
#1 Posted : Wednesday, November 6, 2019 10:00:49 PM(UTC)
Librus Prime

Rank: Paid support

Joined: 11/6/2019(UTC)
Posts: 1
Canada
Location: Winnipeg, Manitoba

How do you output Multiple SQL Tasks (Queries) to 1 file with timestamp in file name?
Offline jrtwynam  
#2 Posted : Thursday, November 7, 2019 5:58:00 PM(UTC)
jrtwynam

Rank: Free support

Joined: 7/20/2017(UTC)
Posts: 134
Canada
Location: Ontario, Toronto

Thanks: 4 times
Was thanked: 18 time(s) in 17 post(s)
Hi,

What I would suggest is creating a job variable to hold the timestamp, using a Set Variable task at the beginning of your job to set the timestamp in that variable, and then you'd have two SQL tasks to pull your results. You could then have two Write File tasks, one for each SQL task to write the SQL task's output to the file, and your destination file would use the value in your timestamp variable.
thanks 2 users thanked jrtwynam for this useful post.
al355 on 11/11/2019(UTC), Support on 11/12/2019(UTC)
Offline Joey S  
#3 Posted : Monday, November 11, 2019 9:19:49 PM(UTC)
Joey S

Rank: Paid support

Joined: 3/26/2018(UTC)
Posts: 27
United States
Location: North Dakota, Grand Forks

Was thanked: 9 time(s) in 8 post(s)
I can address this with the assumption that you want one of two things.

1. One time stamp for the start of the job which will contain one or more tasks that are SQL queries
- Create one job with one task with all of your queries together - see attachment #1)
- the "Output" tab be set how you want/need
- create a second task after the SQL queries that writes a file (Task - File - Write) OR an Email task (if that is what you are looking for)
- the email or file write task can include the time stamp you want (for example - {DATEFORMAT(M/d/yyyy h:mm tt)}) AND the output from your query or queries in the tasks before this file write/email task


2. You want a time stamp for EACH query
- Similar to option 1 above - - Create one job with one task for each of your queries. Be mindful of the Output tab, you will probably want them the same
- Your last task will be like your 2nd task above - a Task that writes a file (Task - File - Write) OR an Email task (if that is what you are looking for)
- the email or file write task will include the time stamp you want (for example - {DATEFORMAT(M/d/yyyy h:mm tt)}) for EACH query - something like this: {TASK(Active|ExecutionTime|hh\:mm\:ss)} AND the output from each of your queries in the tasks before this file write/email task {TASK(Active|StdOut)}

Example for write/email task as described in #2:
{TASK(---your task #1 id here---|ExecutionTime|hh\:mm\:ss)}
{TASK(---your task #1 id here---|StdOut)}

{TASK(---your task #2 id here---|ExecutionTime|hh\:mm\:ss)}
{TASK(---your task #2 id here---|StdOut)}

Etc..
etc..
Offline Joey S  
#4 Posted : Monday, November 11, 2019 9:37:00 PM(UTC)
Joey S

Rank: Paid support

Joined: 3/26/2018(UTC)
Posts: 27
United States
Location: North Dakota, Grand Forks

Was thanked: 9 time(s) in 8 post(s)
The easiest might be to put the time stamp declaration in the query itself, then you do not have to rely on anything else and your output always has it

Add this to the top of your query (or each one if you need)
SELECT CURRENT_TIMESTAMP

Keep in mind you can have multiple queries in a single SQL Task in VC

thanks 1 user thanked Joey S for this useful post.
Support on 11/12/2019(UTC)
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Scroll to Top