Import txt data to infobright

Source: Internet
Author: User

Importing txt data to infobright does not support insert, so data can only be imported through load. However, infobright has strict requirements on the txt format. If the format is incorrect, data cannot be imported. Let's not talk about it. import data 1 and create a table:

           mysql> create table example2 (       -> id int not null,       -> textfield varchar(20) not null,       -> number int not null)engine=birghthouse;          Query OK, 0 rows affected, 2 warnings (0.11 sec)

 

2. Create txt data. This step is very important. If you can import the data, you can see that the format you created is correct. txt content: 1, "one, two or three", 1234 Note: (1) "" is used to separate columns. (2) after each line is written, you must press Enter. Otherwise, the column cannot be imported. 3. Import the txt file to infobright:
           mysql> load data infile 'F:\\in2.txt' into table example2 fields terminated by ',' enclosed by '"';          Query OK, 1 row affected (0.50 sec)          Records: 1  Deleted: 0  Skipped: 0  Warnings: 0

 

The load statement is related to the txt file you created. 4. Verify that:
            mysql> select * from example2;   +----+------------------+--------+   | id | textfield        | number |   +----+------------------+--------+   |  1 | one,two or three |   1234 |   +----+------------------+--------+ 1 row in set (0.02 sec)

 

The txt content can also be as follows: 1, one \, two or three, 1234 load statement also needs to change accordingly
LOAD DATA INFILE 'F:\\in2.txt' INTO TABLE test_table1 FIELDS TERMINATED BY ',' ENCLOSED BY 'NULL' ESCAPED BY '\\';

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.