Creates a new database and the file that is used to store the database.
Starting with the SQL Server Compact 3.5 SP1 release, case-sensitive collations are also supported. However, this support is only available through the native and managed programming APIs. For more information, see Working with Collations (SQL Server Compact) and Supported Collations (SQL Server Compact).
To execute the CREATE DATABASE statement, you must be connected to a database. For information about how to connect to a database, see SQL Server Compact Query Analyzer.
A. Creating a password-protected database
The following example creates a database that uses a password.
CREATE DATABASE "\test1.SDF" DATABASEPASSWORD '<enterStrongPasswordHere>'
When a user tries to connect to a password-protected database without supplying the correct password, SQL Server Compact 3.5 returns an error. For information about errors, see SQL Server Compact Errors.
B. Creating a database that has a collation specified
The following example specifies a specific collation for the database being created.
CREATE DATABASE "SpanishDB.sdf" DATABASEPASSWORD '<enterStrongPasswordHere>' COLLATE Traditional_Spanish_CI_AS
Note When you create a new database, make sure that the correct collation is specified. If a table name is long and has mixed characters such as English and Japanese, the table might not be recognized in the subsequent connections to the database.