Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL fields terminated by tab

I am trying to upload a tab delimitted file with MySQL. I want a query something likes this: LOAD DATA LOCAL INFILE 'file' INTO TABLE tbl FIELDS TERMINATED BY 'TAB' Is there something I can subsitute for TAB to make this work?

like image 291
Brian Avatar asked Apr 06 '10 00:04

Brian


People also ask

What is fields terminated by MySQL?

'FIELDS TERMINATED BY' option should be used when the text file which we want to import into MySQL table is having the values which are separated by a comma(,) or maybe with any other separator like a colon(:), semicolon(;) etc.

What is Local_infile MySQL?

The local_infile system variable controls server-side LOCAL capability. Depending on the local_infile setting, the server refuses or permits local data loading by clients that request local data loading. By default, local_infile is disabled. (This is a change from previous versions of MySQL.)

How do I insert selected columns from a CSV file to a MySQL database using load data infile?

The code is like this: LOAD DATA INFILE '/path/filename. csv' INTO TABLE table_name FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' (column_name3, column_name5); Here you go with adding data to only two columns(you can choose them with the name of the column) to the table.

How do I enable local data Infile in MySQL?

The following is the syntax. mysql> SHOW GLOBAL VARIABLES LIKE 'local_infile'; Here is the output. We can enable the local infile with the help of ON or boolean value true or numeric value 1.


1 Answers

have you tried '\t' the escape sequence + "T" is considered tab... haven't tried, but might be what you need

like image 123
DRapp Avatar answered Oct 15 '22 13:10

DRapp