Exporting from SQLite to SQL Server

后端 未结 6 1698
野的像风
野的像风 2020-12-08 04:52

Is there a tool to migrate an SQLite database to SQL Server (both the structure and data)?

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 05:22

    I know that this is old thread, but I think that this solution should be also here.

    • Install ODBC driver for SQLite
    • Run odbcad32 for x64 or C:\Windows\SysWOW64\odbcad32.exe for x86
    • Create SYSTEM DSN, where you select SQLite3 ODBC Driver
    • Then you fill up form where Database Name is filepath to sqlite database

    Then in SQL Server run under sysadmin

    USE [master]
    GO
    EXEC sp_addlinkedserver 
       @server     = 'OldSQLite', -- connection name
       @srvproduct = '',          -- Can be blank but not NULL
       @provider   = 'MSDASQL', 
       @datasrc    = 'SQLiteDNSName' -- name of the system DSN connection 
    GO
    

    Then you can run your queries as normal user e.g.

    SELECT * INTO SQLServerDATA FROM openquery(SQLiteDNSName, 'select * from SQLiteData')
    

    or you can use something like this for larger tables.

提交回复
热议问题