---
title: "How to migrate from SQLCE to SQL Express"
canonical: "https://support.appfire.com/space/TSH/1800962208/How%20to%20migrate%20from%20SQLCE%20to%20SQL%20Express"
format: markdown
---
> ℹ️ Please reach out to Appfire support in case of any questions or issues concerning the below manual.
> ℹ️ 
> ℹ️ Contact details: [Need support](https://appfire.atlassian.net/wiki/spaces/148176899/pages/1468956714)

### **Prerequisites:**

- Latest TFS4JIRA Self-Hosted version - [download](https://marketplace.atlassian.com/apps/42296/tfs4jira-azure-devops-integration?tab=versions&hosting=cloud)
- Install <span style="color: #0000ee">[SQL Express](https://www.microsoft.com/en-us/download/details.aspx?id=101064)</span> (steps below)
- Install <span style="color: #0000ee">[Export SQLCe tool](https://github.com/ErikEJ/SqlCeToolbox/releases/download/3.5.2/exportsqlce40.zip)</span>
- (optional) Install <span style="color: #0000ee">[SQL Server Management Studio](https://aka.ms/ssmsfullsetup)</span> (SMSS)

### **SQL EXPRESS 2019 installation**

1. Download the installer for your system: <span style="color: #0000ee">[SQL Express](https://www.microsoft.com/en-us/download/details.aspx?id=101064)</span>
2. Start **CUSTOM** installation
3. Choose: **New SQL Server stand-alone installation or add features to an existing installation**
  1. (optional) - do not install Machine Learning Services
  2. Named instance: *TFS4JIRA*
  3. Collation: *SQL_Latin1_General_CP1_CI_AS*
  4. Authentication mode: *Mixed mode*
  5. SA password: <password>
    1. please setup a custom, strong password
    2. some Windows systems require strong passwords via Group Policy

### **MIGRATION**

> ❌ This manual operates on the default user credentials used in TFS4JIRA (provided out of the box). Users may choose to setup different user credentials, especially password that will be used by the application. Here are the password locations that must be corrected:
> ❌ 
> ❌ 1. script
> ❌ 3. **web.config**, <connectionString> section for "SyncProfileContextExpressConnection"


> ℹ️ Users may choose to run the scripts provided below using <span style="color: #0000ee">[SQL Server Management Studio](https://aka.ms/ssmsfullsetup)</span> (SMSS) instead of SQLCMD commands.

#### **Stop TFS4JIRA Synchronizer application pool in IIS using IIS Manager (cmd: inetmgr)**

![image](media://31513b5d-fc18-4b25-9f45-3b4fa5e88756)

#### **Export SQL CE database into an .sql script (schema and data)**

1. Download <span style="color: #0000ee">[Export SQLCe tool](https://github.com/ErikEJ/SqlCeToolbox/releases/download/3.5.2/exportsqlce40.zip)</span> (unzip to find .exe file)
2. Run the following command in the directory where you have downloaded Export SQLCe tool (remember to start terminal as the administrator):

> ℹ️ When the resulting script size exceeds 18,528 KB, **ExportSqlCe40.exe** tool automatically breaks down the output files into **chunks** with index numbers. Check the table below for the expected output and run time:

| **config.sdf file size** | **# of chunks/.sql file count** | **Total size of .sql scripts ** | **Data migration duration** |
| --- | --- | --- | --- |
| 787 MB | 75 | 1.31 GB | ~1.5 hour |
| 1.53 GB | 149 | 2.62 GB | ~2.5 hour |
| 3.05 GB | 298 | 5.25 GB | ~5 hours |

3. Outcome example
4. <span style="color: #333333">(optional) Ppen generated file using SSMS and make sure that file is not empty, you should see SQL commands creating schema and adding data in file.</span>

#### **Create new DB in SQLExpress**

1. Download the script file:
2. In the folder containing above script please create a BAT file or run this command:
  
3. **DB_creation.txt** will be created in the  same folder with script result, example entry:

#### **Populate TFS4JIRA database with SQL CE database schema and content**

1. In the directory where you have exported SQL CE Database content to (location of **Synchronizer_SQLCE_DB.sql** file), execute the following command:
  
2. Result will be saved into **DB_migration.txt**

> ❌ In order to import all the chunks in to SQL express database with single command please run below. Note that all chunks are placed in the EXPORT folder in this example:
> ❌ 
> ❌ - for /f %f in ('dir /b .\EXPORT') do sqlcmd -S localhost\tfs4jira -d TFS4JIRA -i .\EXPORT\%f -E -b -e -x > DB_migration_%f.txt
> ❌ - if used in BAT file: for /f %%f in ('dir /b .\EXPORT') do sqlcmd -S localhost\tfs4jira -d TFS4JIRA -i .\EXPORT\%%f -E -b -e -x > DB_migration_%%f.txt
> ❌ 
> ❌ -b : on error batch abort - process will stop on error  
> ❌ -e : echo input  
> ❌ -x : disable variable substitution

#### Update migrations history

1. Download SQL script:
2. Execute the script on SQL Express database, either by using the command below or by opening this file using SSMS and executing it there (run the command from the script location):
  
3. Result is saved into **DB_migration_history.txt**

#### **Update connection string in web.config (default location: C:\inetpub\wwwroot\tfs-jira-synchronizer)**

1. Update "forceDbType" application setting by changing its value to "SyncProfileContextExpressConnection".
  1. Search for: <add key="forceDbType" value="SyncProfileContextConnection" />
  2. Replace with: <add key="forceDbType" value="SyncProfileContextExpressConnection" />

#### **Start TFS4Jira Synchronizer application pool in IIS**

### <span style="color: #333333">**MIGRATION VALIDATION**</span>

<span style="color: #333333">In order to validate that TFS4JIRA Synchronizer uses SQL Express you can add a new profile or rename one of the existing ones. After that please query "SyncProfiles" using below command</span>

```actionscript
sqlcmd -S localhost\TFS4JIRA -d TFS4JIRA -q "select * from SyncProfiles" -E -e > DB_migration_validation.txt
```

<span style="color: #333333">You should see your changes in DB_migration_validation.txt. Example content:</span>

![image](media://4049df69-aaed-4039-a636-893944811307)

### **ROLLBACK**

In case something goes wrong or there will be problems with SQLExpress database, you can always go back to use SQL CE database. In order to do so follow this steps:

1. Stop TFS4Jira Synchronizer application pool in IIS
2. Change "forceDbType" application settings in Web.config back to "SyncProfileContextCeConnection"
3. Start TFS4Jira Synchronizer application pool in IIS