Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Import data from SQLite database into SQL server 2008 Database. Expand / Collapse
Posted Tuesday, August 07, 2012 1:27 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, August 07, 2012 6:06 AM
Points: 8, Visits: 59

I have to Import/Export data between SQLite and SQL server 2008 databases OR I want to convert SQL Sever 2008 database to SQLite database. Can u pls guide me how to do it?

Post #1341050
Posted Tuesday, August 07, 2012 2:01 AM

Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, April 17, 2014 5:38 AM
Points: 698, Visits: 507
As a data migration task, you'll have some planning to do to ensure data types between the two systems are compatible, especially dates.

You can export data from SQL 2008 in a variety of ways, the easiest being by right-clicking on a database in SQL Management Studio and left-clicking on Export Data or Tasks > Generate Scripts.

Hopefully that will get you started but come back to us if you need further help.

"Be brave. Take risks. Nothing can substitute experience."
Post #1341052
Posted Tuesday, August 07, 2012 12:51 PM



Group: General Forum Members
Last Login: Today @ 2:16 PM
Points: 12,755, Visits: 31,121
i've done this in vb.Net / C#.Net; let us know if you are a programmer and just need a deeper code example.
once i had the reference to System.Data.SQLite it's really easy.

Dim f As String = Application.StartupPath & "\" & "Stormrage.SQLite.db3"

'delete so we can test the whole process:
If File.Exists(f) Then
End If

Dim SQLconn As New System.Data.SQLite.SQLiteConnection()
Dim SQLcommand As SQLiteCommand
Dim sql As String
'create database if it does not exist
If Not File.Exists(f) Then
Dim SQLconnect As New System.Data.SQLite.SQLiteConnection()
'Database Doesn't Exist so Created at Path
SQLconnect.ConnectionString = "Data Source=" & f & ";"
End If
Catch ex As Exception
End Try
'now the file exists, lets add some tables.
SQLconn.ConnectionString = "Data Source=" & f & ";"
SQLcommand = SQLconn.CreateCommand
''drop all the tables if they exist:
'Dim SchemaTable As New DataTable
'SchemaTable = SQLconn.GetSchema(SQLiteMetaDataCollectionNames.Tables, {"NEXUSLEVELS"})
'For int As Integer = 0 To SchemaTable.Rows.Count - 1
' If SchemaTable.Rows(int)!TABLE_TYPE.ToString = "table" Then
' sql =
' End If
'> create table t (
'> a varchar(15) check (length(a) <= 15),
'> b integer check (typeof(b) = 'integer')
sql = "CREATE TABLE [SQLiteDevelopers] ( " & vbCrLf
sql = sql & "[DeveloperID] INTEGER IDENTITY(1,1) NOT NULL, " & vbCrLf
sql = sql & "[DeveloperName] VARCHAR(50) NOT NULL, " & vbCrLf
sql = sql & "[DeveloperType] VARCHAR(30) NULL DEFAULT 'EVIL', " & vbCrLf
sql = sql & " PRIMARY KEY (DeveloperID), " & vbCrLf
sql = sql & " CHECK ([DeveloperType] = 'EVIL' OR [DeveloperType] = 'GOOD' OR [DeveloperType] = 'NEUTRAL') ) " & vbCrLf
sql = sql & " " & vbCrLf
SQLcommand.CommandText = sql


--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1341484
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse