1 (edited by v_pozidis 2017-05-23 11:57:26)

Topic: updating the sqlite.db

A stupid question. In case I have updated my database (sqlite.db)  adding  with one or more tables. How can I move the datas from the old databes to the new one ?

Re: updating the sqlite.db

Not a stupid question. If I'm understanding your question correctly, probably the quickest and easiest solution would be to utilize a product such as SqliteStudio and use the export/import features.

Re: updating the sqlite.db

I have tried it but fails. Don't now the way.

ehwagner wrote:

Not a stupid question. If I'm understanding your question correctly, probably the quickest and easiest solution would be to utilize a product such as SqliteStudio and use the export/import features.

4 (edited by kim143 2017-05-24 06:11:23)

Re: updating the sqlite.db

download sqlite-tools-win32 from https://www.sqlite.org/download.html

extract the zip file and go to command line after that go to the path where you have extracted zip file

please do not open sqlite.exe directly go the way I listed below

example

C:\sqlite>

type "dir" without quotes to list files in folder

if you see the sqlite.exe in that folder than you are fine

to create new database

C:\sqlite> sqlite3 test.db

  it will create blank database test.db in C:\sqlite folder

than follow the command below path to olddatabse must not contain any space in folder name

C:\sqlite> sqlite3 C:\path_to\olddatabase.db ".dump tablename" | sqlite3 test.db

works fine tested it also preserves the table structure and its constraints

now type sqlite3 like

C:\sqlite> sqlite3

and hit enter.

to open database

sqlite> .open test.db

.databases => will list open database
.tables => will list tables available in that database
.schema tablename => will gives structure schema of table
at end

select * from tablename;

to see data from table

Re: updating the sqlite.db

thanks. I triedit but faild. (again)
can you write me the steps?
My old database is sqlite.db and i want to move all the datas to anoter one with the name newone.db

Thank you for your help




kim143 wrote:

download sqlite-tools-win32 from https://www.sqlite.org/download.html

extract the zip file and go to command line after that go to the path where you have extracted zip file

please do not open sqlite.exe directly go the way I listed below

example

C:\sqlite>

type "dir" without quotes to list files in folder

if you see the sqlite.exe in that folder than you are fine

to create new database

C:\sqlite> sqlite3 test.db

  it will create blank database test.db in C:\sqlite folder

than follow the command below path to olddatabse must not contain any space in folder name

C:\sqlite> sqlite3 C:\path_to\olddatabase.db ".dump tablename" | sqlite3 test.db

works fine tested it also preserves the table structure and its constraints

now type sqlite3 like

C:\sqlite> sqlite3

and hit enter.

to open database

sqlite> .open test.db

.databases => will list open database
.tables => will list tables available in that database
.schema tablename => will gives structure schema of table
at end

select * from tablename;

to see data from table

Re: updating the sqlite.db

First you should create new tables and fields using My Visual Database, then you can download tool SQLite Studio where you can open two databases (old and new) and move data between tables.

Dmitry.