Screenack
Screenack

Reputation: 757

Convert MSSQL2008 *.bak file to SQL-CE *.sdf

I wish to convert data from an mssql2008 .bak (or out from a running 2008 server) to sql-ce's *.sdf for use in a webmatrix project. I have SQL Server Management Studio 2008 R2 installed as well.

Upvotes: 2

Views: 2910

Answers (1)

RThomas
RThomas

Reputation: 10880

There is no tool that will directly convert a bak to an sdf.

You're going to have to restore it to a functional SQL Server Engine of the same (or newer) version and then script it out. That's how I'd do it anyway. Also keep in mind that you're not going to be able to use the views, stored procs, triggers, etc, if there are any in the database contained in the .bak file.

There was a codeproject effort with SQL 2005 to create a utility that would help with the conversion from a full blown database to a ce database. You can check it out here:

http://www.codeproject.com/KB/database/SqlCompactCoptUtility.aspx

For help with scripting start here:

http://msdn.microsoft.com/en-us/library/ms178078.aspx

Or to just dive right in: Right-click a database, point to Tasks, and then click Generate Scripts. That will bring up a wizard with all sorts of options to help you get the tables and data moved.

Upvotes: 3

Related Questions