Page 1 of 1

loop thru text file or database records and execute sql

Posted: Mon May 01, 2023 10:42 pm
by asawyer13
Without going into too much detail as to why I have to do this, I want to explain what I want to do.

I want to create a table where each row is a sql command I want to run. These could be queries, possibly with parameters, could be inserts, deletes.

I would like to be able to loop thru these records and execute the sql statements one at a time. I would also like log in another table the rownumber, maybe even the actual sql statement and how long the statement took to run. I don't think I care about how many records were updated/inserted.

I also want the total queries to be able to run as long as they need to without any timeouts. I will be accessing a mysql database if that's needed.

I am fairly new to RoboTask, so if someone could help me get started that would be great.

Thanks
Alan

Re: loop thru text file or database records and execute sql

Posted: Tue May 02, 2023 11:24 am
by Oleg
I am fairly new to RoboTask, so if someone could help me get started that would be great.
First create a table in the database and put there all SQL expressions you want. One SQL per row.
You can process them by using Dataset loop

Another way:
create text files with SQL expressions. One SQL pre file.
You can process them by using File Loop