-2

Hi I have the following Mysql code (Which i export from Mysql DB before I delete my tables from it). Now I have a MySQLlite DB, and I have the corresponding tables in this database. But when I run the INSERT INTO command exported from MySQL database is not seems to be working in MySQLlite. When I research I see that I need to manually add each row as one single INSERT INTO command. I have 100 of rows. It's almost impossible to do that. Any Idea guys how to do this insertion? Thanks in advance..

MYSQL INSERT INTO Command:

INSERT INTO `DEPT` (`id`, `dept_name`, `bp_name`, `standard`, `created_by_id`, `modified_by_id`, `date_created`, `date_modified`) VALUES
(23,    'DEQP', 'Kaizen',   'IEC 60812',    286,    286,    '2016-05-16 14:32:30',  '2016-05-19 14:25:06'),
(31,    'DEQP', 'test', 'IEC 60812',    286,    286,    '2016-05-22 10:50:06',  '2016-05-22 10:55:55'),
(32,    'IT',   'Design',   'IEC 60812',    286,    286,    '2016-05-22 11:13:06',  '2016-05-22 11:13:06');
Andrews B Anthony
  • 1,296
  • 7
  • 25
vellattukudy
  • 759
  • 1
  • 9
  • 23

2 Answers2

1

Export the data from table to a file using

  SELECT *
  INTO OUTFILE '/path/to/file.csv'
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  FROM DEPT

And after exporting use the file to import data into your mysqlite server using

Load data local infile..... Check this link MySQL - LOAD DATA INFILE.

Andrews B Anthony
  • 1,296
  • 7
  • 25
0

SQLite insert one row per line.

SQLite with PHP_PDO will allow you insert multiple rows in one insert. Have a try SIDU: http://topnew.net/sidu see if it can help you.

SIDU
  • 2,168
  • 1
  • 10
  • 19