Generating insert statements from an sqlite table

前端 未结 6 831
滥情空心
滥情空心 2021-02-18 18:28

Is there any tool or script available?

相关标签:
6条回答
  • 2021-02-18 18:50

    DB Browser for SQLite supports SQL generation.

    • Go to File
    • Select Export
    • Click to Database to SQL file...
    • A popup screen will be shown.
    • There you can choose export options and click OK
    • It'll prompt for a location to save generated sql file.

    I hope it'll help the others :)

    0 讨论(0)
  • 2021-02-18 18:50

    As a quick work around for fewer column tables. We can use string concatenation function. Sample example is- select 'insert into TABLE_NAME values('''|| COLUMN1 || ''',''' || COLUMN2 || ''',''' || COLUMN3 || ''',''' || COLUMN4 || ''');' from TABLE_NAME

    0 讨论(0)
  • 2021-02-18 18:53

    I think what you're looking for is:

    sqlite x.db .dump > output.sql
    

    This will dump the SQL to regenerate a database

    0 讨论(0)
  • 2021-02-18 18:58

    If you use the Sqlite manager firefox plugin, it supports bulk inserts from INSERT SQL statements.

    Infact it doesn't support this, but Sqlite Browser does (works on Windows, OS X, Linux)

    0 讨论(0)
  • 2021-02-18 18:58

    To generate output into a file follow these steps:

    $ sqlite3 mytable.db
    
    sqlite> .output output.sql
    
    sqlite> .dump table_name
    
    sqlite> .quit
    
    0 讨论(0)
  • 2021-02-18 18:58

    Hope this helps.

    http://sqliteadmin.orbmu2k.de/

    SQLite Administrator is a powerful tool if you easily want to create, design or administrate SQLite database files. The SQL code editor helps you to quickly write sql queries with features such as code completion and highlighting. Both major versions of SQLite database files are supported by SQLite Administrator. Features:

    * Create / Modify / Delete Tables by Wizard
    * Create / Modify / Delete Indices by Wizard
    * Create / Modify / Delete Views by Wizard
    * Create / Modify / Delete Triggers by Wizard
    * SQL Code Completion that supports table aliases
    * SQL Code Highlighting
    * SQL Error Locating
    * Import Data from CSV Files
    * Export Data ( XLS / CSV / HTML / XML )
    * Store User Queries into Database
    * Search for User Queries
    * Store Images into Blob Fields ( JPG / BMP )
    * Show SQL of each Database Item
    * Migrate SQLite2 Databases to SQLite3
    * Try to keep Indices and Triggers after modifying a Table
    
    0 讨论(0)
提交回复
热议问题