So, here is my question. I have csv file with 130.000 rows (give or take) and I was wondering if it is possible to somehow limit input to only first two rows? I did manage to successfully import file using this block of code:
$sql = "LOAD DATA LOCAL INFILE 'http://localhost/00_VJEZBA/ROK_DEUTCH/csv/wlan_search.txt'
INTO TABLE `test_rok`
FIELDS TERMINATED BY ';'
LINES TERMINATED BY '\n'
(`update_time`,`gefundener`,`conn`,`dbm`,`kod`,`kod`,`mhz`,`value_1`,`value_2`,`value_3`,`dbm_2`)";
$db = connectPDO();
$stmt = $db->prepare($sql);
$stmt->execute();
and adding
[PDO::MYSQL_ATTR_LOCAL_INFILE => true]
into my connection
and as I said, it works fine but I was wondering is it possible to somehow limit input data? I've read somewhere that it can't be done with LOAD DATA LOCAL INFILE
what's my alternative on that matter?
I had a similar case only I needed to test a load of a file with about 3 million records. Using Ajay's comment above, I did "more filename.txt", copied 5 records and pasted into a test file then loaded that. +1 Ajay.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.