Community forum

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


Dunkel
2017-02-04T21:20:02Z
Hi all
I'm trying to find af way to join tables from two different databases.
I've tried with two SQL tasks carrying one parameter from task one to task two:
Task one: select memberID from MYTABLE1
Task two: Select * from MYTABLE2 where MYTABLE2.memberID = {TASK(PrevTask,StdOut)}
That works quite well.

But i'm looking for at way to carry more than one parameter from task one.
Something like:

Task one: select memberID, postDATE from MYTABLE1.....
Task two: Select * from MYTABLE2 where MYTABLE2.memberID = '{TASK(PrevTask,StdOut)}memberID' and MYTABLE2.anotherDATE = '{TASK(PrevTask,StdOut)}postDATE'

Any advise?
Thanks in advance
Sponsor
Forum information
thomas
2017-02-06T09:15:51Z
From query 1 you can do Select param1, param2. These will be the inputs to the next task. In the output tab, set Field separator to for example semicolon.
In the second query, you can use this function to split the parameters:

Capture.PNG
Dunkel
2017-02-06T10:40:39Z
Hi Thomas
Thanks for the quick reply :-)
The funktion works fine, so I can target one specific row- and column number.

But what I need, is to be able to join not just one specific row/column but the whole table.
So if SQL task one returns 5 rows (with two columns), I want to join all rows with data from SQL task two.
Lets assume that matching data exists in MYTABLE2 (100% match) then SQL task two returns 5 rows.

Does it make sense?
thomas
2017-02-06T11:26:36Z
Ah. That's going to be tricky. If you want to do it with VisualCron tasks like this, it would have to be a loop over all the results in task 1, and then call task2 with parameters for each iteration. Doing it in one go is not going to work (I think), because it would have to be an IN or EXIST statement to give you the correct results.
The query you have in Task 2, isn't going to work if {TASK(PrevTask,StdOut) has multiple rows.

Are these databases in different Sql Server instances?

If so, you have a couple of options. You can create linked servers in Sql server. Then you can query across different instances. Performance with linked servers can be bad, so only do this for light queries.

Or you can do it in .NET where you join the two datasets, but that's a bit more work.
Dunkel
2017-02-06T13:17:17Z
Hi Thomas
I feared that answer :-)
Are these databases in different Sql Server instances? Yes unfortunatly
But thank you for your time - at least I learned about 'Get column by row, column and column separator' :-)

Scroll to Top