Convert Sql Server database to Sql CE 4

A couple of days ago I had to migrate from SQL Server 2012 to SQL Server CE 4. I tried to do it manually, but gave up very soon.

Google helps again, after some research I found a couple of open source C# projects which do the work. Non of them worked for me, but I still took some pieces of code and wrote my own converter.

To avoid version conflicts I post it as a C# class. To make it work you have to create a VS solution (Console Application in my case) and include references to those assemblies:

Microsoft.SqlServer.Smo.dll, Can be found here: C:\Program Files\Microsoft SQL Server\110\SDK\Assemblies

Migrator creates new SQL CE4 database and generates .sql script of database.

Hope it will help someone.

Views: 4367 Comments: 1
Paulina on 15 January 2014 11:09 says

That saves me. Thanks for being so selenbis!

It's sad to say, but..
Due to the enormous amount of spam I have decided to disable comments on my website. Feel free to contact me through any other available channel.