SQL Server Compact

Microsoft relational database


title: "SQL Server Compact" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["microsoft-server-technology", "windows-mobile", "relational-database-management-systems", "microsoft-database-software", "discontinued-microsoft-software"] description: "Microsoft relational database" topic_path: "technology/databases" source: "https://en.wikipedia.org/wiki/SQL_Server_Compact" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Microsoft relational database ::

::data[format=table title="Infobox file format"]

FieldValue
nameSQL Server Compact
extension.sdf
ownerMicrosoft
genreRelational database
::

Microsoft SQL Server Compact (SQL CE) is a discontinued relational database produced by Microsoft for applications that run on mobile devices and desktops. Prior to the introduction of the desktop platform, it was known as SQL Server for Windows CE and SQL Server Mobile Edition.

It includes both 32-bit and 64-bit native support. SQL CE targets occasionally connected applications and applications with an embedded database. It is free to download and redistribute. An ODBC driver for SQL CE does not exist, nor is one planned. Native applications may use SQL CE via OLE DB.

The latest, and last, release is SQL Server Compact 4.0. In February 2013 SQL Server Compact Edition had been deprecated; no new versions or updates are planned, although Microsoft continued to support the product until July 2021.

Overview

SQL Server Compact shares a common API with the other Microsoft SQL Server editions. It also includes ADO.NET providers for data access using ADO.NET APIs, and built-in synchronization capabilities, as well as support for LINQ and Entity Framework. Future releases will unify the synchronization capabilities with Microsoft Synchronization Services. Unlike other editions of Microsoft SQL Server, SQL CE runs in-process with the application which is hosting it. It has a disk footprint of less than 2 MB and a memory footprint of approximately 5 MB. SQL CE is optimized for an architecture where all applications share the same memory pool. Windows Store apps for Windows 8 cannot use SQL Server Compact edition, or any other edition of SQL Server.

::data[format=table title="Versions"]

Official nameCommon nameRelease dateSupport date
SQL CE 1.02000-10-26
SQL CE 1.12001-03-21
SQL CE 2.02002-09-16
SQL Server 2005 Mobile EditionSQL CE 3.02006-01-14
SQL Server 2005 Compact EditionSQL CE 3.12007-02-19url=https://docs.microsoft.com/en-us/lifecycle/products/microsoft-sql-server-2005
SQL Server Compact 3.5SQL CE 3.52008-02-19url=https://docs.microsoft.com/en-us/lifecycle/products/microsoft-sql-server-compact-35
SQL Server Compact 4.0SQL CE 4.02011-04-13url=https://docs.microsoft.com/en-us/lifecycle/products/microsoft-sql-server-compact-40
::

Support

SQL CE databases can support ACID-compliance, but do not meet the durability requirement by default because AutoFlush buffers changes in memory (including enlisted ambient transactions and explicit SQL CE transactions that do not override the Commit() call with an CommitMode.Immediate value). Therefore, committed transaction changes can be lost. To meet the durability requirement the commit call on the transaction must specify the immediate flag. Like Microsoft SQL Server, SQL CE supports transactions, referential integrity constraints, locking as well as multiple connections to the database store. However, nested transactions are not supported, even though parallel transactions (on different tables) are. The current release does not support stored procedures or native XML data type either. It uses a subset of T-SQL for querying and due to lack of XML support, XQuery is not supported either. Queries are processed by an optimizing query processor. SQL CE databases also support indexing, as well as support remote data replication (local caching of data in remote databases) and merge replication (bidirectional synchronization with master databases).

SQL CE databases can be created and managed from Microsoft Visual Studio and some older versions of SQL Server Management Studio as well.

File format

| name = SQL Server Compact | extension = .sdf | mime = | owner = Microsoft | creatorcode = | genre = Relational database | containerfor = | containedby = | extendedfrom = | extendedto = SQL CE databases reside in a single .sdf file, which can be up to 4 GB in size. The .sdf file can be encrypted with 128-bit encryption for data security. SQL CE runtime mediates concurrent multi-user access to the .sdf file. The .sdf file can simply be copied to the destination system for deployment, or be deployed through ClickOnce. SQL CE runtime has support for DataDirectories. Applications using an SQL CE database need not specify the entire path to an .sdf file in the ADO.NET connection string, rather it can be specified as |DataDirectory|.sdf, defining the data directory (where the .sdf database file resides) being defined in the assembly manifest for the application.

SQL Server Management Studio 2005 can read and modify CE 3.0 and 3.1 database files (with the latest service pack), but SQL Server Management Studio 2008 (or later) is required to read version 3.5 files. Microsoft Visual Studio Express 2008 SP1 can create, modify, and query CE 3.5 SP1 database files. SQL Server Management Studio cannot read CE 4.0 files. Visual Studio 2010 SP1 can handle CE 4.0 database files.

The .sdf ("Sqlce Database File") naming convention is optional, and any extension can be used.

Setting a password for the database file is optional. The database can be compressed and repaired with the option of the compacted/repaired database to be placed into a new database file.

Deprecation

In February 2013, Microsoft announced that SQL Server Compact Edition had been deprecated.

Although no new versions or updates are planned, Microsoft will continue to support SQL Compact through their standard lifecycle support policy. Extended support for SQL Server Compact 4.0 ended on July 13, 2021.

References

References

  1. "SQL Server 2005 Compact Edition Datasheet".
  2. (13 January 2011). "Microsoft SQL Server Compact 4.0 is available for download and use with WebMatrix".
  3. "A Lap Around SQL Server 2005 Compact Edition".
  4. "SQL Server Everywhere: Just Another Database?".
  5. "What's New (SQL Server Compact Edition)".
  6. "How do i run SQL Server Compact 3.5 on Windows 8 developer preview?". social.msdn.microsoft.com.
  7. (2000-10-26). "Microsoft Launches SQL Server 2000 Windows CE Edition at PASS 2000". news.microsoft.com.
  8. (2001-03-21). "Microsoft Delivers Support for Embedded Devices With Release of SQL Server 2000 Windows CE Edition Version 1.1". news.microsoft.com.
  9. (2002-09-16). "Microsoft Delivers Next Stage of .NET Solution For Enterprise Mobile Development". news.microsoft.com.
  10. "Microsoft SQL Server 2005".
  11. "Microsoft SQL Server Compact 3.5".
  12. "Microsoft SQL Server Compact 4.0".
  13. (28 June 2007). "Maintaining Databases (SQL Server Compact Edition)".
  14. "Transactions (SQL Server Compact Edition)".
  15. "Overview of Databases (SQL Server Compact Edition)".
  16. "Overview of Databases (SQL Server Compact Edition)".
  17. "Data Storage Architecture with SQL Server 2005 Compact Edition".
  18. Barranis, Patrick. (2013-01-11). "Port SQL Compact to Windows RT".
  19. "Microsoft SQL Server Compact 4.0 Support Dates".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

microsoft-server-technologywindows-mobilerelational-database-management-systemsmicrosoft-database-softwarediscontinued-microsoft-software