Skip to content

Command line tools

Erik Ejlskov Jensen edited this page Nov 13, 2016 · 12 revisions

This project contains 4 command line applications:

  • ExportSqlCE - for scripting an entire SQL Server Compact 3.5 database
  • ExportSqlCE40 - for scripting an entire SQL Server Compact 3.1 database
  • ExportSqlCE31 - for scripting an entire SQL Server Compact 3.1 database and
  • Export2SqlCE - for scripting an entire SQL Server 2005/2008 database providing SQL Compact compatible T-SQL statements.

Command line samples for ExportSqlCE, ExportSqlCE40 and ExportSqlCE31:

To generate a SQL script from the database file

    ExportSQLCE.exe [SQL Compact Connection String] [output file location] [exclude] [schemaonly|dataonly] [saveimages] [sqlazure]

    ExportSQLCE.exe "Data Source=D:\Northwind.sdf;" Northwind.sql
    ExportSQLCE.exe "Data Source=D:\Northwind.sdf;" Northwind.sql exclude:Shippers,Products

To create a schema diff script

  ExportSQLCE.exe diff [SQL Compact or SQL Server Connection String (source)] [SQL Compact or SQL Server Connection String (target)] [output file location]

  ExportSQLCE.exe diff "Data Source=D:\Northwind.sdf;" "Data Source=.\SQLEXPRESS,Inital Catalog=Northwind" NorthwindDiff.sql

To create a database graph

  ExportSQLCE.exe dgml [SQL Compact or SQL Server Connection String (source)] [output file location]

  ExportSQLCE.exe dgml "Data Source=D:\Northwind.sdf;" C:\temp\northwind.dgml

To create a Windows Phone DataContext

 ExportSQLCE.exe wpdc [SQL Compact or SQL Server Connection String (source)] [output file location]

 ExportSQLCE.exe wpdc "Data Source=D:\Northwind.sdf;" C:\temp\Northwind.cs

To script an entire database to SQLite format

 ExportSQLCE.exe [SQL CE Connection String] [output file location] [sqlite]

 ExportSQLCE.exe "Data Source=D:\Northwind.sdf;" Northwind.sql sqlite