SQL Server Compact
Discontinued embedded relational database for mobile and desktop applications.
Last updated
Microsoft SQL Server Compact (SQL CE) was a free, embeddable relational database from Microsoft for mobile and desktop apps, originally named SQL Server for Windows CE and later SQL Server Mobile Edition. It supported both 32-bit and 64-bit systems and targeted occasionally connected or embedded scenarios.
No ODBC driver existed or was planned; native apps could use it via OLE DB. The final release was version 4.0, deprecated in February 2013. Microsoft supported it until July 2021, with no further updates.
Overview
SQL Server Compact shares a common API with other Microsoft SQL Server editions and includes ADO.NET providers for data access, built-in synchronization capabilities, and support for LINQ and Entity Framework. It runs in-process with the hosting application, with a disk footprint under 2 MB and memory footprint around 5 MB. Windows Store apps for Windows 8 cannot use SQL Server Compact or any other SQL Server edition.
Support
SQL CE databases support ACID-compliance but do not meet the durability requirement by default unless the commit call specifies the immediate flag. It supports transactions, referential integrity constraints, locking, and multiple connections, but not nested transactions.
Stored procedures and native XML data type are not supported, and it uses a subset of T-SQL without XQuery. SQL CE supports indexing, remote data replication, and merge replication. Databases can be created and managed from Microsoft Visual Studio and some older versions of SQL Server Management Studio.
File format
SQL CE databases reside in a single .sdf file, which can be up to 4 GB in size and optionally encrypted with 128-bit encryption. The .sdf file can be deployed by copying or through ClickOnce, and the runtime supports DataDirectories for simplified connection strings. SQL Server Management Studio 2005 can read CE 3.0 and 3.1 files, while version 3.5 requires Management Studio 2008 or later; CE 4.0 files cannot be read by Management Studio.
Visual Studio 2010 SP1 can handle CE 4.0 files. The .sdf extension is optional, and a password for the database file is optional. The database can be compressed and repaired into a new file.
More in Windows Mobile
Sources
Compiled from Wikipedia and the sources listed below. Text from Wikipedia is available under CC BY-SA 4.0; this entry is adapted from it.
- Wikipedia: SQL Server Compact (CC BY-SA 4.0).
Spotted an error? Know more?
Reader corrections go straight into our review queue. Suggest an edit · How this site is sourced
