sql database compare tool


Guest post
This is a guest post from Phil Factor.
Phil Factor (real name withheld to protect the guilty), aka Database Mole, has 30 years of experience with database-intensive applications.
Despite having once been shouted at by a furious Bill Gates at an exhibition in the early 1980s, he has remained resolutely anonymous throughout his career.
He is a regular contributor to and .
Our goal is to show how to use Pro command line with PowerShell to automate the following processes:
- Getting a new database into version control, or updating the object scripts in the VCS to reflect the latest database changes
- Creating a new build script for a database version, from the object scripts in the VCS
- Creating a database migration script to upgrade a target database to the version represented by the source object scripts
Getting a new database into version control
If we have an existing database that is not yet in source control, we can use SQL Compare to compare the source database to a directory of object scripts, which is linked to a Version Control System such as GitHub, SVN or TFS.
SQL Compare will update the target directory, producing a set of object creation scripts that represent the current state of the database metadata in the source database. If the directory is empty, SQL Compare will write out the script files for every object in the database and create the necessary subdirectories to hold them. Then, it is easy to use a version control tool such as TortoiseSVN, TortoiseGit or GitHub to create a repository.