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.