Part 1: Backing Up and Restoring the SQLDB Database to an ‘SQLDB_B4’ Database (which will be used for Comparing Changes)
1. Backup the current SQLDB Database to file (eg SQLDB_20231023.bak)
a. Right-click the current SQLDB database, Click 'Tasks,' and Click 'Back Up.'
b. In the 'Destination' options, Click 'Add,' then append to the 'File name' field a
suitable Back-Up file name (eg SQLDB_20231023.bak)<></>
c. Click 'OK' to Execute the Backup.
2. Source Options
a. In the 'Source' options, Right-Click on 'Databases' and choose 'Restore
Database'.
b. Click 'Device,' Click the '...' Box, Click 'Add,' Choose the previously created
Database Backup File (e.g. SQLDB_20231023.bak), Click 'OK,'.
3. Destination Options
a. In the 'Destination' options, Change the Database name from the current SQLDB
Database to 'SQLDB_B4'
4. Select a Page Options
a. In the ‘Select a Page’ options (upper left of the Restore Backup form), Select the
'Files' page
b. On the 'SQLDB_Data' row, click the 'Restore As' column and insert '_B4' into the
'MDF' filename (eg .... SQLEXPRESS\MSSQL\DATA\SQLDB_B4.
c. On the 'SQLDB_Log' row, click the 'Restore As' column and insert '_B4' into the
'LDF' filename (eg .... SQLEXPRESS\MSSQL\DATASQLDB_B4_
5. Click 'OK' to Execute the Restore.
Part 2: Using the “SQL_GenTableDifferencesScript” script to Create a “TableDifferencesScript” and then using the resulting Script to generate a final result (showing the original and changed lines in succession)
1. Executing the “SQL_
a. Right Click the current SQLDB Database in SQL Server Management Studio and
Execute the 'SQL_
2. Using the resulting “TableDifferencesScript” to determine the Tables, Rows and
Columns that have been changed
a. Copy the Resulting "SQL TableDifferencesScript" from above to a 'New Query.'
Window and 'Execute' it.
3. Modify the TableDifferencesScript using the resulting rows of its initial result to
produce “Before and After” differences
a. Using the initial result of the TableDifferencesScript, Update the Commented
Line's 'IN ( -1 )' statement by replacing '-1' with the resulting row’s Primary Key
value (which is usually the 'SeqNum' value)
b. Uncomment the Commented Line
c. Re-Execute the TableDifferencesScript to achieve a “Before and After” view of
the Table/Row/Column Adds and Changes