Recently I’ve stumbled upon a small nifty tool, that’ll allow you to retrieve the database schema of your SQL Compact Edition database ^.^
The tool is relatively easy to work with, provided you have the correct SQLCE runtimes installed..
In my case (having a x64 system) I had to install the x86 runtime first, and after that the x64 runtime.
Anyhow, the tool is not made by me, but it’s made by Erik Ejlskov Jensen.
You can find his blog here
The tool can be downloaded here
It’s available as an addin for SQL Server Management Studio 2008 (Express) or as a simple CLI
Using the CLI tool is pretty easy.
Just open up your CMD window, point to the directory where the EXE is located and type, for example, the following:
‘ExportSqlCE.exe “Data Source=MyDataBaseFile.sdf;” MyDataBaseSchema.sql‘
Mind you that the “MyDataBaseFile.sdf” is the location of where your SDF file is located. If you have place the file in the same directory as the ExportSqlCE tool, then you’ll only have to put the filename there.
Otherwise you’d have to place the full file path 🙂
Hit enter and when the operation is complete, you’ll have a nice *.sql file containing the sql commands to create your tables and insert data that was already in there.
There are also several flags available to be used with the EXE, more info when you use the /? flag 😉