Linkz
Linkz

Reputation: 51

How to select from sqlite table and dump to .sql file?

I am trying to select records from a SQLite.db3 table and create a new insert.sql file.

these are the commands that I have used:

SQLite> .mode insert
SQLite> .output newFile.sql
SQLite> .dump

The problem I have is that I do not want to copy the entire db into newFile.sql. I only want to certain data from a table like: select * from table1 where status = 1

Upvotes: 0

Views: 537

Answers (1)

Linkz
Linkz

Reputation: 51

I have found a working solution:

sqlite> .open Corrupt.db3
sqlite> .mode insert
sqlite> .output NewTable.sql
sqlite>  select * from OldTable where Status = 1;
sqlite> .output stdout

Upvotes: 1

Related Questions