July 19, 2012 at 2:57 am
Hi Team,
We have a scenario where we have to check two tables(say table1 primary and table2 back up) continuously and the data should be pulled as soon as one of the table is loaded. To do this we have used a ForLoop which is checking for two variable values(this value is Rowcount of the tables) continuously and whenever the value of any one variable is greater than 0, ForLoop should be success and it should proceed to pull the data.
Inside the ForLoop we have two ExecuteSQL task which is counting(Select Count(*) from table1) the number of rows in table1 and table2 and assigning it to the variables (@LoopRecordCountPrimary and @LoopRecordCountSecondary).
The EvalExpression for ForLoop is (@LoopRecordCountPrimary==0) || (@LoopRecordCountSecondary==0)
Now the issue is, ForLoop is becoming success only when both the variables are having values greater than 0, but we want it to become success when one of the variable is greater than 0.
I request you to please suggest or guide us. Thanks much for your time.
Regards
Jim
July 19, 2012 at 3:21 am
I must be missing something (seems too obvious), but surely something like this?
(LoopRecordCountPrimary > 0) || (@LoopRecordCountSecondary > 0)
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
July 19, 2012 at 6:17 am
Hi,
I have changed to (@LoopRecordCountPrimary>0) || (@LoopRecordCountSecondary>0), but in this case ForLoop is always showing success. It is not entering into the ExecuteSql Task. Is, the approach correct to pull data from table1 or table2 as soon as the data is loaded? If there is any different approach please suggest.
Also, please let me know if I use two ExecuteSQL tasks which are counting the rows from tables and assigning to two variables simultaneously, will the ForLoop be able to check these two variable with this condition (@LoopRecordCountPrimary>0) || (@LoopRecordCountSecondary>0) and check whether the data load has happend or not?.
Thanks
Regards
Jim
July 19, 2012 at 6:35 am
OK, I thought about this a bit harder.
How about this?
(@LoopRecordCountPrimary+@LoopRecordCountSecondary)==0
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply