Common commands for migrating databases to SQLite and SQLite

Source: Internet
Author: User
Tags import database

OracleMigrateSQLite

ArticleReference: http://blog.csdn.net/johnnycode/article/details/7413111 #

1. query the data you want from PL/SQL and export the data to a CSV file;

You can also use scripts to export CSV files, as shown in the following code:

 
-- Set colsep'|';
 
Set echo off;
 
Set feedback off; -- disable counting feedback of the last row.
 
Set heading off; -- disable the output Column Title
 
Set pagesize 0; -- set the number of rows displayed to print the column name once.
 
Set linesize 1000;
 
Set numwidth 12;
 
Set termout off;
 
Set trimout on; -- clear unnecessary Spaces
 
Set trimspool on;
 
Set Newpage none; -- no page flip, no blank lines in the output file
Spool E: \ name.csv;
 
-- Select col1 |','| Col2 from table_name;
 
Select T. type_code |','| T. type_name from t_ B _op_type T;
 
Spool off;

2. Open the CSV file in notepad. First, we need to process the character set of the CSV file. As we all know

SQLite default Character Set UTF-8, involving Chinese, if not set, then the data imported into SQLite will be garbled

Right-click the CSV file and choose notepad to open it. The following data is displayed:

Remove the first row and column, and then remove the semicolon. The final result is

This step below is most important, save the file as, select UTF-8 at the bottom of the encoding, and then save it to the root directory of the E disk.

2. Create a database

Run the authorization command to access the sqlitefolder under the authorization, and enter sqlite3.exe mydata. dB (database name ),

If no path is specified, sqlite3 creates the database file in the directory running sqlite3 by default. (This process will not generate dB files)

 
Sqlite3.exe mydata. DB

3. Create a table

The table creation statement can be copied from Oracle. After the table is created, run the. TA Command to check whether the table is created successfully. (DB files are generated after this process)

 
Create Table t_ B _op_type...
 
 
 
. Ta

4. The default CSV data Delimiter is comma (,), while the default SQLite data Delimiter is comma (|). Use the. show command to confirm.

. Show

Change the separator to ",". separator ","

Confirm again. Show

 
. Show

5. import data (. Import // import command)

 
. Import database path \ mydata. DB

6. Verify

 
Select * From t_ B _op_type ;//Do not use fewer semicolons

OK,Success!

IfPCNot InstalledSQLiteSQLiteOperationAndroidMobile phone Processing

Reference: http://blog.csdn.net/johnnycode/article/details/7413111 #

SQL ServerMigrateSQLite

It seems that this SQL _server_to_sqlite_db_converter software is very powerful. This tool can be used to convert the SQL Server database to SQLite data, including structure and data, which can be done directly!

Tool: http://files.cnblogs.com/huwei_good/ SQL _Server_To_SQLite_DB_Converter_bin.zip

SQL Server address: Database address

Select DB: select database

SQLite database file path: path for saving SQLite database files;

Password: Set the Database Password

After entering this information, click Start export!

The software was downloaded from a foreign website and written in C #.ProgramIs open-source. You can download it here: Ghost.

SQLiteCommon commands

Entry series:Http://www.cnblogs.com/myqiao/archive/2011/07/10/2102465.html

SQLiteCommon commands and instances:Http://huangjianming31.blog.163.com/blog/static/34740871201062121316395

SQLiteCommon commands and Syntax:Http://blog.csdn.net/linchunhua/article/details/7184439

SQLiteCommon setting commands:Http://www.cnblogs.com/caizhimin816/articles/1885349.html

In SQLite, It is case sensitive. So how can SQLite be case sensitive? There are three solutions:
Solution 1: Use case-insensitive conversion functionsLower,Upper
1. Select * from test where upper (name) = 'abc ';
2. Select * from test where lower (name) = lower ('abc ');
Solution 2: forcibly declare case insensitive during comparison
Select * from test where name = 'abc' collate nocase;
Solution 3: declare that the field is case insensitive when creating a table
Create Table Test (_ id integer, Name text collate nocase );

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.