Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

SQL Server Compact Edition (SQL CE) is a legacy embedded database engine that stores data in .sdf files. Its final major release was SQL Server Compact 4.0, distributed as 4.0 SP1, and Microsoft support ended on July 13, 2021. Existing applications may still run in a controlled Windows/.NET Framework environment, but SQL CE is unsupported and is not a sound default for new development. Its 4 GB database limit and missing server features are key reasons to plan a migration.

What is SQL Server Compact Edition?

SQL Server Compact—also called SQL Server Compact Edition, SQL Server CE, or SQL CE—is an embedded, file-based relational database engine. Rather than connecting to a separately administered database server, a compatible application uses the SQL CE provider to work with a database file, usually ending in .sdf.

Microsoft designed it for lightweight Windows desktop, device, and older ASP.NET scenarios. The runtime could be installed on a computer or privately deployed with an application. “SQL Server Mobile” is a name found in older historical contexts; it does not make SQL CE equivalent to a current SQL Server edition.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

SQL CE is not SQL Server Express, LocalDB, SQL Server Developer Edition, Azure SQL Database, or SQL Server Management Studio (SSMS). Those products have different engines, deployment models, and capabilities.

Is SQL Server Compact still supported?

No. Microsoft lists mainstream support for SQL Server Compact 4.0 as ending July 12, 2016, and extended support as ending July 13, 2021. The Microsoft lifecycle page is the reference for those dates.

Microsoft still lists a SQL Server Compact 4.0 SP1 download. That means the legacy installer remains available; it does not mean the product has resumed development or support. See the Microsoft Download Center page for the package. For a stable legacy application, continued use may be practical if the environment is controlled and the organization accepts the support risk. For new development, modernization, or a system with support or compliance requirements, choose a supported database instead.

What is the latest SQL Server Compact version?

The final major product version is SQL Server Compact 4.0. SQL Server Compact 4.0 SP1 is the relevant Microsoft redistributable package; it is not a new, actively developed release. Versions 3.5 and 4.0 can coexist on a desktop, and installing 4.0 does not upgrade an application or database from 3.5 automatically. Confirm which version the application expects before changing its runtime.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What are the main limits?

  • 4 GB maximum database size: this is a hard limit for SQL CE 4.0, not a comfortable target. If a file is nearing it, allow for growth and operational headroom and begin planning a move.
  • No stored procedures, triggers, views, or replication: these are among the features Microsoft specifically identifies as unsupported.
  • It is not a database server: a file-based engine does not provide the same centralized administration, server-side jobs, high-availability features, or operating model as a server database.
  • Provider and SQL differences matter: Compact and full SQL Server use different engines and ADO.NET providers. Similar-looking application code is not proof that queries, types, transactions, or concurrency behave identically.

These are important distinctions, not a complete feature-by-feature comparison. Microsoft’s older ASP.NET guidance for SQL Server Compact documents the size and feature limits and cautions about differences from full SQL Server.

Can SQL CE run on current Windows or modern .NET?

Do not assume compatibility just because an old application still runs on one computer. The verified Microsoft deployment guidance is centered on Windows, .NET Framework, and older ASP.NET application models; the download page lists .NET Framework 3.5 SP1 or .NET Framework 4 for managed application development. It does not establish official provider support for modern .NET, ASP.NET Core, Entity Framework Core, or non-Windows systems.

A particular legacy application may continue to operate under a specific configuration, but verify its exact operating system, process architecture, framework, provider, and deployment. New projects on modern .NET should not choose SQL CE on the assumption that the old provider will be supported.

How do I install or deploy SQL Server Compact 4.0 SP1?

  1. Identify the application’s database version. Determine whether it uses SQL CE 3.5 or 4.0; do not infer this from the file extension alone.
  2. Identify process architecture. Check whether the application runs as x86 or x64. The Microsoft download page offers separate SSCERuntime_x86-ENU.exe and SSCERuntime_x64-ENU.exe installers. Use the package that matches the process and deployment arrangement.
  3. Choose installation or private deployment. SQL CE supported a historical private-deployment model in which the application shipped with required managed assemblies and native components. ASP.NET projects also used NuGet packages to include dependencies. Private deployment still requires correct native binaries and architecture; it does not eliminate runtime or file-permission requirements.
  4. Test using a copy of the database. Confirm that the application can read and write the copy in the target environment before changing production.

Older projects may reference packages named Microsoft.SqlServer.Compact and, for Entity Framework 6 integration, EntityFramework.SqlServerCompact. Their presence in a project does not guarantee a modern, supported setup; verify the package and framework compatibility before restoring or redeploying it. Microsoft’s historical ASP.NET example uses this connection string pattern:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Data Source=|DataDirectory|App.sdf;

|DataDirectory| is a path-substitution token documented for older ASP.NET deployment patterns. The correct provider declaration and options depend on the application. Do not assume this string works unchanged with ASP.NET Core, modern .NET, EF Core, or another provider.

Because SQL CE accesses a file, the application also needs suitable filesystem access. Check that the application identity can read and, where needed, write the database at the resolved path. Shipping the runtime does not grant permission to modify a protected or read-only directory.

How do I open an .sdf database?

  1. Make a backup and work on a duplicate, not the sole production file.
  2. Find out whether the file is SQL CE 3.5 or 4.0, and whether it is encrypted or password-protected.
  3. Use a compatible SQL CE tool. A community-maintained option is SQLite & SQL Server Compact Toolbox, which offers Visual Studio and SSMS extensions, a standalone application, and command-line tools. Check that the version supports your Windows, IDE, provider, and database file.
  4. Inspect and script schema and data before attempting conversion. After migration, verify row counts, indexes, constraints, data types, identity values, and important query results.

SSMS does not natively manage SQL Server Compact databases; Microsoft’s older guidance also says SQL Server Data Tools does not support them. The fact that the toolbox can be installed as an SSMS extension does not make SQL CE itself an SSMS database type. Historical alternatives included Visual Studio Server Explorer and WebMatrix tools, with varying functionality.

Rank #3
Forvencer Server Book, 2 Zipper Pocket, Server Books for Waitress
  • Upgraded Two Zipper Pockets: Forvencer server books feature two secure zipper pockets for better organization of coins, cash, and receipts, ensuring that everything you collect has a safe and secure place
  • Smart Storage & Quick Access: Designed with 8 multi-functional compartments, the right side includes a guest receipt pad, while the left has a money pocket, ticket pocket, and credit card slot. Two small clear pockets store bills, receipts, and other visible items. A stitched pen loop ensures you always have your favorite pen ready
  • High-quality & Easy to Clean: Crafted from high-quality PU leather with heavy-duty stitching, this server book is built to last. It resists tears, scratches, and its waterproof surface makes cleaning easy with just a damp cloth or a non-chlorine sanitizer
  • Perfect Fit for Your Apron: Measuring 5” x 8”, this compact organizer is slightly smaller than other models, making it ideal for bending or sitting while carrying in your server apron. It holds everything a waitress needs—a place for everything
  • What's Included: This server organizer comes with multiple open and zippered pockets to store money, receipts, tips, etc. Clear sleeves are perfect for keeping menus or special lists while serving. Available in a variety of colors, allowing you to express yourself even when in uniform

Can I use SQL Server Compact with ASP.NET or Entity Framework?

Historically, yes: SQL CE was used with older ASP.NET applications and Entity Framework-era projects. Microsoft’s documentation describes private deployment for ASP.NET, the |DataDirectory| pattern, and an Entity Framework integration package. This means older .NET Framework applications may have a viable maintenance path; it is not evidence of EF Core support.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For an application being migrated, plan to change the provider and connection string and review migrations, identity generation, SQL, transactions, and concurrency assumptions. Test against the destination database rather than treating provider replacement as a configuration-only change.

Can multiple users or web requests use the same database?

SQL CE was used in ASP.NET scenarios, but a shared file is not a substitute for a database server when an application needs high concurrency, multiple application servers, centralized administration, replication, high availability, or server-side processing. Whether a small, controlled workload is acceptable depends on how the application accesses the file and its write patterns. Repeated lock contention or growth in usage is a signal to reassess the architecture, not just to keep increasing retries.

Common SQL CE problems and checks

“The provider cannot be loaded” or “Bad Image Format”

  • Check whether the process is x86 or x64 and whether the deployed native components match it.
  • Confirm whether the app expects SQL CE 3.5 or 4.0, and that the required assemblies were deployed.
  • Verify the expected .NET Framework is available and inspect for conflicting machine-wide or private copies of provider files.

Identify the mismatch before installing runtimes at random. Installing both architectures does not correct a process that loads the wrong native library.

“The database is locked”

Another process may have the file open, a transaction may not have completed, or another service such as backup, antivirus, synchronization, or indexing software may be touching it. Stop the application, copy the database, verify that no process still owns the file, then test reads and writes against the copy. If a web deployment has recurring contention or multiple workers accessing the same file, reassess whether a server database is the better fit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Access denied” or writes do not persist

Check the application identity’s filesystem permissions, the resolved database path, and whether the file or containing directory is read-only or protected. File-based storage requires permissions on the database location; the engine does not write through a separate database-service account.

“The .sdf file will not open”

Check the file version, encryption or password settings, tool compatibility, and whether the application currently has it open. Corruption is also possible. Preserve the original and attempt any repair or export only on a copy.

“The database is too large”

At or near the 4 GB ceiling, cleanup is not a durable capacity plan. Back up and validate before archiving or removing data, and prioritize migration to an engine that fits the expected growth.

“Queries fail after migration”

Review unsupported Compact features, SQL syntax, data-type conversions, identity behavior, date/time handling, null semantics, identifier quoting, paging, string comparison and collation, transaction behavior, and generated provider SQL. Compare results as well as whether a query executes: different engines and providers can produce different behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How do I migrate an .sdf file?

Migration is not just copying a database file or changing a connection string. Use a staged process:

  1. Back up the source. Preserve the original and perform a trial migration from a copy.
  2. Inventory the application. Record the SQL CE version, schema, provider, data volume, queries, constraints, indexes, identity columns, and any framework integration.
  3. Choose a target. Create a destination database in SQL Server Express, another SQL Server edition, Azure SQL Database, or another suitable engine.
  4. Script and convert. Use a compatible tool such as SQL Server Compact Toolbox or an equivalent workflow to extract schema and data. Review types, SQL syntax, constraints, indexes, and any assumptions that rely on Compact behavior.
  5. Import and verify. Recreate required indexes and constraints, compare row counts and identity values, and validate representative queries and business-critical records.
  6. Update the application. Change the provider, connection string, and framework integration as required. Review ORM migrations and generated SQL rather than assuming they transfer unchanged.
  7. Test operational behavior. Test concurrency, transactions, backups, deployment, permissions, and recovery against the target in a production-like environment.
  8. Plan cutover and rollback. Decide how writes will be stopped or reconciled during cutover, keep a recoverable source backup, and define how to restore service if validation fails.

For Azure SQL, Microsoft’s developer-support article describes a SQL CE data-extraction workflow: How do I get data from SQL CE to Azure DB? Treat any particular tooling steps as workflow guidance, not a guarantee that every schema migrates without edits.

For the historical Visual Studio/Web Deploy workflow, Microsoft documented that its Web Deploy provider for automated SQL Server database deployment and schema updates did not work with SQL CE in the same way it did with SQL Server; an older provider could perform initial deployment but not incremental schema updates. The documentation distinguishes Code First Migrations, which did not use that provider. This is legacy tooling guidance, not a description of every modern deployment system.

What should replace SQL Server Compact?

Option Consider it when Trade-off
SQL Server Express You want a small production database in the SQL Server family and can operate a server-style instance. It is not a portable single-file embedded replacement. Installation, administration, connection, and migration work differ from SQL CE. Microsoft lists Express as a free edition for development and production; check the current edition limits for the version you deploy at Microsoft SQL Server downloads.
SQL Server Developer You need a full SQL Server feature set for local development, conversion, and testing. It is for development and test, not production use. Check Microsoft’s current licensing terms.
Azure SQL Database You want a managed cloud database and the application can rely on network connectivity. Requires Azure administration and brings connectivity and usage-cost considerations. Microsoft describes a free offer with per-subscription and per-database limits; allowances and eligibility can change, so check the current offer details.
SQLite You still need an embedded, file-based database and want to evaluate a different engine for your platform and workload. It is not a drop-in SQL CE replacement. Review SQL, types, concurrency, migrations, provider APIs, and encryption requirements.
SQL Server Standard or Enterprise The application requires capabilities or scale beyond a small Express deployment. Licensing and operating requirements depend on edition and deployment. Evaluate current terms and workload needs.

SQL Server 2025 Express edition materials list a maximum relational database size of 50 GB, up to four CPU cores, and up to 1,410 MB of memory. These figures are specific to that release, not a timeless promise; verify current limits in Microsoft’s SQL Server 2025 editions material. Choose a target by workload and operating model, not just by the word “SQL” in its name.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should you keep SQL Server Compact or migrate?

Keeping SQL CE can be a defensible short-term choice for a stable, small, Windows/.NET Framework application when the database is comfortably below 4 GB, the missing features are not needed, the team can reproduce and test the deployment, and the organization accepts unsupported software. Maintain tested backups and document the runtime and architecture the application requires.

Prioritize migration if the application is actively evolving, the database is approaching its ceiling, contention is recurring, multiple application servers are required, missing features are needed, the platform is moving to modern .NET or non-Windows, or security and support obligations rule out an unsupported engine. The practical decision is not whether an old application can still start; it is whether its dependencies and data can be operated and recovered safely for the time you need them.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.