SQL Server Compact

{{Short description|Microsoft relational 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.{{cite web | url = http://download.microsoft.com/download/7/f/c/7fc20778-4e2e-4944-b432-ed74b404e542/sqlservercompactdatasheet_final.doc | title = SQL Server 2005 Compact Edition Datasheet | access-date = 2007-07-03 | archive-url = https://web.archive.org/web/20070316004210/http://download.microsoft.com/download/7/f/c/7fc20778-4e2e-4944-b432-ed74b404e542/sqlservercompactdatasheet_final.doc | archive-date = 2007-03-16 | url-status = dead }} 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.{{cite web | url = https://cloudblogs.microsoft.com/sqlserver/2011/01/13/microsoft-sql-server-compact-4-0-is-available-for-download-and-use-with-webmatrix/ | title = Microsoft SQL Server Compact 4.0 is available for download and use with WebMatrix | date = 13 January 2011 | access-date = 2020-03-11}} 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.{{cite web |url=http://www.devx.com/dotnet/Article/33049/0 |title=A Lap Around SQL Server 2005 Compact Edition |access-date=2005-07-03}} 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.{{needs update|date=December 2023|reason=Did this happen? If not, it doesn't look like it ever will}}{{cite web |url=http://www.ddj.com/dept/database/193402926 |title=SQL Server Everywhere: Just Another Database? |access-date=2007-07-03}} 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.{{cite web |url=https://technet.microsoft.com/en-us/library/ms172417.aspx |title=What's New (SQL Server Compact Edition) |access-date=2007-07-03}}

Windows Store apps for Windows 8 cannot use SQL Server Compact edition, or any other edition of SQL Server.{{cite web|title=How do i run SQL Server Compact 3.5 on Windows 8 developer preview?|url=http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/f71c518c-c288-459e-917f-52b9cf8442d7|publisher=social.msdn.microsoft.com|access-date=11 March 2013}}

class="wikitable"

|+Versions

!Official name

!Common name

!Release date

!Support date

{{ubl|SQL Server 2000 Windows CE Edition|SQL Server CE 1.0}}

|SQL CE 1.0

|2000-10-26{{cite web |date=2000-10-26 |title=Microsoft Launches SQL Server 2000 Windows CE Edition at PASS 2000 |work=news.microsoft.com |url=https://news.microsoft.com/2000/10/26/microsoft-launches-sql-server-2000-windows-ce-edition-at-pass-2000/ |access-date=2022-04-16}}{{^ |2000-06-30 Beta=https://news.microsoft.com/2000/04/19/microsoft-details-sql-server-2000-windows-ce-edition-features-and-announces-beta-release-date/}}

|

{{ubl|SQL Server 2000 Windows CE Edition 1.1|SQL Server CE 1.1}}

|SQL CE 1.1

|2001-03-21{{cite web |date=2001-03-21 |title=Microsoft Delivers Support for Embedded Devices With Release of SQL Server 2000 Windows CE Edition Version 1.1 |work=news.microsoft.com |url=https://news.microsoft.com/2001/03/21/microsoft-delivers-support-for-embedded-devices-with-release-of-sql-server-2000-windows-ce-edition-version-1-1/ |access-date=2022-04-16}}{{^ |2002-01-22 SP1=https://news.microsoft.com/2002/01/22/microsoft-releases-service-pack-1-for-sql-server-2000-windows-ce-edition/ |2001-04-18 Evaluation=https://news.microsoft.com/2001/04/18/developers-can-go-mobile-with-microsoft-sql-server-2000-windows-ce-evaluation-edition/}}

|

{{ubl|SQL Server 2000 Windows CE Edition 2.0|SQL Server CE 2.0}}

|SQL CE 2.0

|2002-09-16{{cite web |date=2002-09-16 |title=Microsoft Delivers Next Stage of .NET Solution For Enterprise Mobile Development |work=news.microsoft.com |url=https://news.microsoft.com/2002/09/16/microsoft-delivers-next-stage-of-net-solution-for-enterprise-mobile-development/ |access-date=2022-04-16}}{{^ |2002-04-10 Beta=https://news.microsoft.com/2002/04/10/teched-2002-microsoft-extends-xml-web-services-support-into-every-facet-of-the-net-enterprise-server-family/}}

|

{{^ |codename=Laguna}}

|SQL Server 2005 Mobile Edition

|SQL CE 3.0

|2006-01-14{{^ |2004-07-26 Beta2=https://news.microsoft.com/2004/07/26/microsoft-announces-sql-server-2005-support-for-amd64/ |2004-12-03 CTP=https://news.microsoft.com/2004/12/03/microsoft-releases-updates-for-sql-server-2005-while-enterprise-customers-continue-to-choose-sql-server-2000-over-the-competition/ |2006-11-15 RC=https://news.microsoft.com/2006/11/15/microsoft-advances-data-platform-for-customer-gain/}}

|

SQL Server 2005 Compact Edition

|SQL CE 3.1

|2007-02-19

|2016-04-12{{cite web |url=https://docs.microsoft.com/en-us/lifecycle/products/microsoft-sql-server-2005 |title=Microsoft SQL Server 2005 |department=Lifecycle |website=Microsoft Docs |access-date=2021-02-26}}

SQL Server Compact 3.5

|SQL CE 3.5

|2008-02-19{{^ |2008-08-06 RTM?=https://news.microsoft.com/2008/08/06/microsoft-releases-sql-server-2008/}}

|2018-04-10{{cite web |url=https://docs.microsoft.com/en-us/lifecycle/products/microsoft-sql-server-compact-35 |title=Microsoft SQL Server Compact 3.5 |department=Lifecycle |website=Microsoft Docs |access-date=2021-02-26}}

SQL Server Compact 4.0

|SQL CE 4.0

|2011-04-13

|2021-07-13{{cite web |url=https://docs.microsoft.com/en-us/lifecycle/products/microsoft-sql-server-compact-40 |title=Microsoft SQL Server Compact 4.0 |department=Lifecycle |website=Microsoft Docs |access-date=2021-02-26}}

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.{{cite web|title=Maintaining Databases (SQL Server Compact Edition)| date=28 June 2007 |url=http://msdn.microsoft.com/en-us/library/ms172411(v=sql.90).aspx}} 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.{{cite web | url = https://technet.microsoft.com/en-us/library/ms172400.aspx | title = Transactions (SQL Server Compact Edition) | access-date = 2007-07-03}} 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.{{cite web | url = https://technet.microsoft.com/en-us/library/ms172037.aspx | title = Overview of Databases (SQL Server Compact Edition) | access-date = 2007-07-03}} 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).{{cite web | url = https://technet.microsoft.com/en-us/library/ms171986.aspx | title = Overview of Databases (SQL Server Compact Edition) | access-date = 2007-07-03}}

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

{{Infobox 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,{{cite web | url = http://msdn2.microsoft.com/en-us/library/bb380177.aspx | title = Data Storage Architecture with SQL Server 2005 Compact Edition | access-date = 2007-07-03}} 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.{{citation needed|date=November 2016}}

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.{{citation needed|date=November 2016}}

The .sdf ("Sqlce Database File") naming convention is optional, and any extension can be used.{{citation needed|date=November 2016}}

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.{{citation needed|date=November 2016}}

Deprecation

In February 2013, Microsoft announced that SQL Server Compact Edition had been deprecated.{{cite web|title=Port SQL Compact to Windows RT|url=https://connect.microsoft.com/SQLServer/feedback/details/776328/port-sql-compact-to-windows-rt|author=Barranis, Patrick|date=2013-01-11|website=Microsoft Connect|access-date=2016-06-25}}

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.{{cite web|title=Microsoft SQL Server Compact 4.0 Support Dates|url=https://docs.microsoft.com/en-us/lifecycle/products/microsoft-sql-server-compact-40|access-date=2020-09-17}}

See also

References

{{reflist}}