Posted by Saturday, April 13, 2013on
There is not out of the box solution to this, since CE 4.0 came after MS SQL 2008. You can use CE 4.0 inside VS 2012, but SQL 2008 only can work with C4E 3.5 and before.
So, the solution is to download and install a standlone tool for CE 4.0 that allows you open and manipulate the data.
1. Download and install SQL Server Compact Toolbox from CodePlex here: http://sqlcetoolbox.codeplex.com/releases/view/69910
2. Run it and from menu, click open and look for your .sdf file
3. Right click on the database and click on "Script Database and Data..."
4. Give it a name, and choose "SQL Server Script (*.sql)" type
5. Go to your MS SQL 2008, select (or create) the database you will use in MS SQL 2008
6. Open the .sql file, and run it
7. Check, all tables and data must be there now!
Here the solution from Marc in Stack Overflow: