Interesting Factoid: SQL Server Compact Edition

Doing some background research ahead of Sunday’s presentation.  Thought I’d share this little nugget of wisdom:

There are three ways to create a SQL Server CE database.

1. Through a Connection Wizard via Visual Studio or SQL Server Management Studio,
2. Programatically, using .Net (the SqlCeEngine class), or
3. using the CREATE DATABASE T-SQL statement.

What is interesting is option #3.  How do you think you’d go about executing this statement?  If you did it in SSMS you have to have an active connection, right?

Well, I unearthed the answer – you have to execute the statement within SQL Server CE Query Analyzer (on a mobile device)!

“To execute the CREATE DATABASE statement, you must be connected to a database. For information about connecting to a database, see SQL Server Compact Edition Query Analyzer.”

So for practical reasons, only options #1 and #2 really apply for creating an .sdf file on a Windows Desktop.

About Rob Sanders

IT Professional and TOGAF 9 certified Enterprise Architect with nearly two decades of industry experience, 18 years in commercial software development and 11 years in IT consulting. Check out the "About Rob" page for more information.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.