SQLTeam.com | Weblogs | Forums

Exporting SQLlite to Microsoft SQL server

Want to export sqllite data to microsoft sql server. In my PC, sql server is installed.
I have sqlite.db file that I wanted in sql server(both the structure and data). I don't have any external tool to convert this data. data contain more than 90,000 rows. any help how I convert this .db file in sql server?

Welcome to forum. one way to do it, is use python. Do you have access? This is of course referencing my sqllite db. there are more ways to do this.

import sqlite3
from sqlite3 import Error

def create_connection(db_file):
    """ create a database connection to the SQLite database
        specified by the db_file
    :param db_file: database file
    :return: Connection object or None
    conn = None
        conn = sqlite3.connect(db_file)
    except Error as e:

    return conn

def select_all_functions(conn):
    Query all rows in the tasks table
    :param conn: the Connection object
    cur = conn.cursor()
    cur.execute("SELECT * FROM securityfunctions")

    rows = cur.fetchall()

    for row in rows:

def main():
    database = r"C:\mcc\apps\airgap-e\src\db\airgap.db"

    # create a database connection
    conn = create_connection(database)
    with conn:
        print("1. Query task by priority:")

if __name__ == '__main__':

Also look at the comment section of this article

1 Like

another approach to use OPENROWSET, requires you to install sqllited ODBC driver