Hello,
A very common situation is when developers need to update their database with fresh data from test or production environments, but the problem begins when you use the MorphX VCS and need to keep this data. Below I show the shortest and fastest way that I’ve found to do that:

First, we need to make a backup of the VCS data, for that, connect to the SQL Server using the Microsoft SQL Server Management Studio, choose the transactional database that you need to update with the fresh data and then run the commands:

1
2
3
4
5
6
7
--Creating a temp database to use on our process
CREATE DATABASE MyTempBackup
 
--Backuping the data
SELECT * INTO MyTempBackup.dbo.SysVersionControlMorphXItemTable FROM SysVersionControlMorphXItemTable
SELECT * INTO MyTempBackup.dbo.SysVersionControlMorphXLockTable FROM SysVersionControlMorphXLockTable
SELECT * INTO MyTempBackup.dbo.SysVersionControlMorphXRevisionTable FROM SysVersionControlMorphXRevisionTable

Now you can restore the fresh data on DEV’s environment and then we can restore our backed up data.

1
2
3
4
5
6
7
8
9
10
11
12
--Just to ensure that there is no trash on tables, you can skip this step
TRUNCATE TABLE SysVersionControlMorphXItemTable
TRUNCATE TABLE SysVersionControlMorphXLockTable
TRUNCATE TABLE SysVersionControlMorphXRevisionTable
 
--Restoring the data
INSERT INTO SysVersionControlMorphXItemTable SELECT * FROM MyTempBackup.dbo.SysVersionControlMorphXItemTable
INSERT INTO SysVersionControlMorphXLockTable SELECT * FROM MyTempBackup.dbo.SysVersionControlMorphXLockTable
INSERT INTO SysVersionControlMorphXRevisionTable SELECT * FROM MyTempBackup.dbo.SysVersionControlMorphXRevisionTable
 
--Removing the temp database
DROP DATABASE MyTempBackup

See ya,
Pichler