I am trying to run two SQL scripts via batch file, then pushing the outputs to log files, running a GetVariable file content on the results. Then I CheckVar if var1 is equal to Var 2. However, half the times the output of only one of the variables is not actually grabbed as the variable. But If I look at the log file, it has the text in it.
Here is the abbreviated procedure:
WriteTextToFile("DECLARE @countnum VARCHAR(2000)
DECLARE @countrules1 VARCHAR(2000)
SELECT @countrules1 = parameter1 FROM table1
SELECT @countnum = len(@countrules1) - len(replace(@countrules1,',',''))
SELECT CAST(@countnum AS INT) + 1 ") , "C:\user\results1.log"
WriteTextToFile("SELECT COUNT(*) FROM table2 WHERE parameter2 = #UniqueID#") "C:\user\results2.log"
I write two batch files that execute the .sql scripts. Then I run getVariable("File Content", "c:\user\results1", "variable1")
and getVariable("File Content","c:\user\results2","variable2")
IFcheckVar("#variable1#") Is Equal To "#variable2#"
sendEmail.... I put the variables in the body of the email to verify the variables are correct.
The script runs correctly, the logs are created correctly yet the variable given back is blank. I've ran this one about 20 different machines and about 1/4 of them won't attach the results to the variable on variable1. I can go and look inside the text file and see it has the correct results though. Any thoughts on this?