How to: Use the Database Upgrade Tool (SQL Server Compact Edition)

The Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition) Database Upgrade tool lets you upgrade a SQL Server Compact Edition 1.0 or 2.0 database to work with SQL Server 2005 Compact Edition. This command-line tool must run on the smart device, and both the source and destination databases must be located on the device.

To download and install the SQL Server Compact Edition Database Upgrade tool

  1. The database upgrade tool is installed with Visual Studio 2005 as part of SqlMobile30DevTools[lang].msi file. The default location of the file is <drive>:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0\[platform]\[processor]\upgrade.exe.

  2. Using ActiveSync, copy the upgrade.exe file to the My Device folder on the smart device.

To open a command line on the smart device

  1. To open the command prompt window on a Pocket PC device, press and hold the action or enter button on the device.

  2. While pressing the action or enter button, tap and hold the clock icon in the top menu bar.

  3. Release the action or enter button. A menu with two options (Run and Clock) is displayed.

  4. Click Run. The command prompt window is displayed.

    It is important to note that this method of opening a command line might not work on all smart devices. For Pocket PC 2003 devices, you can install Windows Mobile Developer Power Toys, which includes the PPC Command Shell.

To run the upgrade tool

  1. In the Open text box of the command prompt window, type the command to upgrade your database. The upgrade tool uses the following syntax:

    upgrade.exe /s "\dir1\source.sdf" /sp "password1" /d    "\dir2\destination.sdf" /dp “password2" /e /q

    For more information about the parameters used with upgrade.exe, see the table later in this topic.

  2. When the upgrade is completed, a message box displays the results, success or failure.


This example shows how to convert a database named MyDb1.sdf to a SQL Server Compact Edition database named MyUpgradesDB.sdf. The resulting database is encrypted and password-protected.

upgrade.exe /s "\DB\MyDb1.sdf" /sp "P@ssw0rd" /d 
   "\DB\MyUpgradedDB.sdf" /dp “P@ssw0rd2" /e

The following table lists the parameters that you can use with the Database Upgrade tool.

Parameter Description


The path of the source database file (required).


The password for the source database file (optional).


The path of the destination database file. If you specify an existing file, the file will be overwritten (required).


The password for the destination database file (optional).


If specified, the destination database will be encrypted. If you specify the /e parameter, you must also specify /sp and provide a password (optional).


Perform the upgrade silently without any UI (optional).


Displays this list of parameters (optional).

See Also


Database Upgrade Tool (SQL Server Compact Edition)


Upgrading SQL Server Mobile and SQL Server CE

Help and Information

Getting SQL Server Compact Edition Assistance