导入SQL对于SQLiteSQL、SQLite

2023-09-06 16:28:46 作者:非善类.

我在SQL格式的数据库,我需要做的SQLite的副本,以增加它在Android应用我做。

I have a database in sql format, and I need to make an sqlite copy in order to add it in an Android App I'm making.

到目前为止,我还没有得到任何东西为我工作。我试图导入到SQL SQLite数据库浏览器,但它没有正确导入,它总是给了一个错误的语句。我试图创建一个数据库,然后导入的表,但它坠毁。

So far, I haven't got anything working for me. I tried to import the sql into SQLite Database Browser but it doesn't import properly, it always gives out an error statement. I tried creating a database then import the tables but it crashed.

我试图通过终端使用sqlite3的(我使用的是Mac,如果这将使任何区别),但是.IMPORT文件表格式不工作,它说:错误:没有这样的表:表。我试过一个空表使用CREATE TABLE test42再创造.IMPORT TEST.SQL test42和变体,但它说:错误:附近的测试:语法错误

I tried using sqlite3 via Terminal (I'm using a Mac if that would make any difference), however the .import FILE TABLE format doesn't work, it says: "Error: no such table: TABLE". I tried creating an empty table using "create table test42" then ".import test.sql test42 and variants but it says "Error: near "test": Syntax error".

我卡住了。

任何帮助将极大地帮助。谢谢你。

Any help would greatly help. Thanks.

推荐答案

我最终什么事做的是出口的每个表为CSV,这给我的表值。所有我需要做的就是修改表头和我有我的SQLite文件来完成。这是一个有点费时,但没有最终的伎俩。

What I ended up doing is exporting each table as a CSV, which gave me the table values. All I needed to do then is modify the table headers and I had my sqlite file done. This was a bit time consuming, but did the trick in the end.