I have a .sql
file and I need to run all the rows, insert all the records that are in it, into a table inside SQLite.
Content of file mydb.sql
:
CREATE TABLE tblVeiculo (VeiculoId INT, Codigo [TEXT(9)], Fabricante [TEXT(255)], Modelo [TEXT(255)], AnoInicial INT, AnoFinal INT, Portas INT, Combustivel [VARCHAR(30)], NrMotorObstruido BOOLEAN);
INSERT INTO tblVeiculo (VeiculoId, Codigo, Fabricante, Modelo, AnoInicial, AnoFinal, Portas, Combustivel, NrMotorObstruido) VALUES (1, '001034066', 'AGRALE', 'MT 12.0 4X2 SB(E-TRONIC)(URB.) DIES 2P BASICO', 2005, 2013, 2, 'DIES', 1);
INSERT INTO tblVeiculo (VeiculoId, Codigo, Fabricante, Modelo, AnoInicial, AnoFinal, Portas, Combustivel, NrMotorObstruido) VALUES (2, '001034078', 'AGRALE', 'MT 12.0 4X2 LE(E-TRONIC)(RODOV.) DIES 1P BASICO', 2005, 2013, 1, 'DIES', 0);
INSERT INTO tblVeiculo (VeiculoId, Codigo, Fabricante, Modelo, AnoInicial, AnoFinal, Portas, Combustivel, NrMotorObstruido) VALUES (3, '001034080', 'AGRALE', 'MT 12.0 4X2 LE(E-TRONIC)(RODOV.C/AR) DIES 1P BASICO', 2005, 2013, 1, 'DIES', 0);
INSERT INTO tblVeiculo (VeiculoId, Codigo, Fabricante, Modelo, AnoInicial, AnoFinal, Portas, Combustivel, NrMotorObstruido) VALUES (4, '001034091', 'AGRALE', 'MT 12.0 4X2 LE(E-TRONIC)(URBANO) DIES 2P BASICO', 2005, 2013, 2, 'DIES', 0);
COMMIT TRANSACTION;
PRAGMA foreign_keys = on;
How can I populate an SQLite database through a .sql
??