Toad World® Forums

Issue with Automation - Using Loop (Data Point version 3.5)

Using I have developed an Automation script using Loop .

the query in my Loop Dataset is the following:

select clientid, clientname from mlproduction.dbo.client where clientid in (10979,7187)

when I run the final automation Script with Select to File resulting Excel file contains data Clientid = 10979 but the name of the file (using #variable#) contains 7187.

Please advise.

thank you.

Best regards

Can you attach your automation script and automation log file? I would like to take a look.

Is the SelectToFile inside the loop? It sounds like it is outside. Here is another reference on how to build these types of scripts.…/1133.aspx


You are using #client_SQL# in the export file name of the File_1 activity. client_SQL is a SQL-type variable meaning its value is a result set. In case such variable is used ‘as is’ w/o specifying a column, the value of the 1st column in the 1st row is substituted. In your case it’s 10979.

To fix it, use #client_SQL.clientid# in the export file name instead.


It worked. Thank you Igor.