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 '\\';