Use the File Import and Export function of SQLite

Source: Internet
Author: User
Tags sqlite db
The nearest possible opportunity is to convert the "db_createsqle.exe" file from the "accessmdbfile" file to an SQL statement to generate a database in sql08. Suddenly I had an idea: instead of generating SQLite DB from the MDB file, simply find the information: mdbview.exe can generate a CSV file (Note: Save As UTF-8 format), This makes it easy to use the SQLite import function to import data. The command is as follows: Import
Command:. Import
SQLite>. Import file name table name
Note 1: Do not forget the Starting Point
NOTE 2: This statement cannot end with a semicolon. Non-SQL statements do not need to end with a semicolon.
NOTE 3: You need to check the default separator. It must be consistent. Otherwise, the SQLite field may be incorrectly divided.
Run the. show command to view the delimiter. If the Delimiter is inconsistent, modify it directly, for example:
SQLite>. separator ","
Convert the separator into a comma.
Example 1:
Import the data in file a.csv into Table tab_xx. (fields in a.csv are separated by commas)
SQLite> . Separator ","
SQLite>. Import a.csv tab_xx
SQLite>
Import is complete.

Export
Implementation Method: redirects the output to a file.
Command:. Output
SQLite>. Output a.txt
Then, enter an SQL statement to query the data to be exported. After the query, the data is not displayed on the screen and is directly written to the file.
Enter
SQLite>. Output stdout
Redirects the output to the screen.
Example 2:
Export the data in tab_xx to the a.txt file.
SQLite>. Output a.txt
SQLite> select * From tab_xx;
SQLite>. Output stdout
Export completed.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.