Toad World® Forums

Export multiple tables to csv

Dear all,

I am quiet new with TOAD V12.

I want to Export multiple tables via script to csv, e.g.:

select * from customer into c:\hs\customer.csv

select * from articles into c:\hs\arcticles.csv

How to do this in TOAD?

Thanks for help.

BR, Heinz

Go to the Schema Browser.

Select the tables that you want to export.

Right-click and choose Export Dataset.

Thanks for answer, John.

I was not precise enough :frowning:

I am interested in a script that can I run every day, outputfile should be defined in script.

Select can have joins…

select field1, field2, field10 from customer where feild1 like ‘9%’ into c:\hs\customer.csv

select field1, field2, field10 from articles where feild1 like ‘8%’ into c:\hs\articles.csv

(200 more selects following)

Any idea how to realize?

Well, it’s not exactly a script, but if your goal is to run this from a command line, you could set up your exports in the automation designer, and then run them from command prompt. If you are exporting from queries, each export action can have only one query, but if you are exporting entire tables or views, then you can put multiple tables/views in an export action. In either case, you can run all of them from command prompt.

AutomationDesigner.jpeg

So, to run those 3 export dataset actions (which are in “App1”), I could run Toad from command prompt like this: Toad.exe -a App1

Use Pentaho Kettle Open Source. You define seperate transformation for every SQL statement. Use a Table Input and combine it with a CSV Output or a Excel Output so every SQL has a matching CSV File.

After defining your transformations, combine them with a job to execute them all together.

Run them from command line or scheduled.

Kettle is a Java ETL tool. We use it in several ways against DB2, Oracle and MSSQL databases.