Load data from multiple data files into multiple tables using single control file - sql-loader

I have 3 data files and 3 tables. Is there any way to enter the data from the data files to their respective tables using only a single control file using parameters.
I know that we can use multiple datafiles to insert data into single table but i want multiple datafiles to insert data into multiple tables.

I have not done it, but you can specify multiple files as long as they are the same layout by using multiple INFILE clauses. Then as long as there is some identifier in the record, you can use multiple INTO TABLE clauses, each with its own WITH clause. See the control file reference for more info. Please let us know how it works out.

Related

Excel to Multiple Tables in One Database Output - PDI

I'm using Pentaho Data Integration for my ETL process...
I have multiple excel files that I need to merge and upload in one database. However, I cannot Distribute the fields into its corresponding tables in the database. I can only send it to one table at a time. Is there any other way to do this? How can I have multiple target table?
P.S. I'm using MySQL Workbench for the database.
Thank you for your help!
You can connect multiple Table output steps to your last processing step and set it to copy all rows to both or all target steps. Connect Table outputs (or Insert/update, etc) like in the image, then right-click the step where the stream splits and select Copy Data to Next Steps. In the Table outputs you obviously only specify the columns that apply to that table.

VBA - moving Sharepoint table with attachments to local tables

We are working on archiving data from multiple linked sharepoint tables to local access tables. However they have attachment fields so we are getting the multifield error when our vba is running the Select into statement. Is there a way around this and also preserve the attachment as well? Is there another way to convert the tables with out the select into statement that would be better? I checked but the other questions about this did not have this specific issue.
You did not post if you have anything in attachments fields and if you are trying to preserve data in them.
If not, simply use append query to move data to local table, with selected fields, excluding attachment fields.

Merge two different sql file to one

I have two .sql file for MySql database with same tables but different rows.
How can I make one .sql file with the datas of other two?
If your files contain data only (DML - SELECTs, INSERTs etc.), then you can join them simply via notepad. But both of files must contain the same table (the same columns)!

Importing a CSV file into mysql. (Specifically about create table command)

I hava text file full of values like this:
The first line is a list of column names like this:
col_name_1, col_name_2, col_name_3 ......(600 columns)
and all the following columns have values like this:
1101,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1101,1,3.86,65,0.46418,65,0.57151...
What is the best way to import this into mysql?
Specifically how to come up with the proper CREATE TABLE command so that the data will load itself properly? What is the best generic data type which would take in all the above values like 1101 or 3.86 or 0.57151. I am not worried about the table being inefficient in terms of storage as I need this for a one time usage.
I have tried some of the suggestions in other related questions like using Phpmyadmin (it crashes I am guessing due to the large amount of data)
Please help!
Data in CSV files is not normalized; those 600 columns may be spread across a couple of related tables. This is the recommended way of treating those data. You can then use fgetcsv() to read CSV files line-by-line in PHP.
To make MySQL process the CSV, you can create a 600 column table (I think) and issue a LOAD DATA LOCAL INFILE statement (or perhaps use mysqlimport, not sure about that).
The most generic data type would have to be VARCHAR or TEXT for bigger values, but of course you would lose semantics when used on numbers, dates, etc.
I noticed that you included the phpmyadmin tag.
PHPMyAdmin can handle this out of box. It will decide "magically" which types to make each column, and will CREATE the table for you, as well as INSERT all the data. There is no need to worry about LOAD DATA FROM INFILE, though that method can be more safe if you want to know exactly what's going on without relying on PHPMyAdmin's magic tooling.
Try convertcsvtomysql, just upload your csv file and then you can download and/or copy the mysql statement to create the table and insert rows.

Can I import tab-separated files into MySQL without creating database tables first?

As the title says: I've got a bunch of tab-separated text files containing data.
I know that if I use 'CREATE TABLE' statements to set up all the tables manually, I can then import them into the waiting tables, using 'load data' or 'mysqlimport'.
But is there any way in MySQL to create tables automatically based on the tab files? Seems like there ought to be. (I know that MySQL might have to guess the data type of each column, but you could specify that in the first row of the tab files.)
No, there isn't. You need to CREATE a TABLE first in any case.
Automatically creating tables and guessing field types is not part of the DBMS's job. That is a task best left to an external tool or application (That then creates the necessary CREATE statements).
If your willing to type the data types in the first row, why not type a proper CREATE TABLE statement.
Then you can export the excel data as a txt file and use
LOAD DATA INFILE 'path/file.txt' INTO TABLE your_table;