SQL Source Control - 3.1

SQL Source Control

Getting a specific version - SQL Source Control

You can update your database to a specific version using the History dialog box

Note that when you do this, the current database schema (and any data you have source controlled) is overwritten with the version you selected.

Getting a specific version within SQL Source Control requires SQL Server Management Studio Integration Pack and SQL Compare 8.50 or later

Alternatively, if you do not have SQL Server Management Studio Integration Pack installed, you can manually create a local copy using your source control system, and synchronize it with the database using SQL Compare

Getting a specific version from the History dialog box

When you get a version form the History dialog box, SQL Compare is used to update the target database.

To get a specific version:

  1. On the History dialog box, select the version you want to get.
  2. Click Update to this version with SQL Compare

    A progress dialog box is displayed while the details of the version you selected are determined.

  3. A SQL Compare project launches with the version you selected set as the source, and the database as the target:

  4. To update the database, perform the comparison, ensure all objects you want to update are selected, and run the synchronization wizard.

For more information, see Worked example: Comparing and synchronizing two databases, in the SQL Compare documentation.

Getting a specific version manually

If you do not have SQL Server Management Studio Integration Pack installed, you can get a specific version using your source control system and SQL Compare.

Example: getting a specific revision with TortoiseSVN

This example creates a local copy of the revision, and synchronizes the database using SQL Compare:

  1. Check out the latest version to a new folder.
  2. Right-click the folder, and from the TortoiseSVN menu, select Show log

    The Log Messages dialog box is displayed.

  3. Select the revision you want to get, right-click, and click Revert to this revision
  4. A confirmation dialog box is displayed. Click Yes

    The folder of scripts is updated to the revision you selected.

  5. Using SQL Compare, set the scripts folder as the source for a comparison, and the database as the target, then compare and synchronize.

    The database is updated to the revision you selected.

Example: getting a specific changeset with TFS

This example updates the TFS local copy to a specific changeset, and synchronizes the database using SQL Compare:

  1. In Visual Studio, in the Source Control Explorer tab, select the database, right-click, and click Get Specific Version

    The Get dialog box is displayed.

  2. Under Version, in Type select Changeset
  3. Type the changeset number, or click the browse button to display the Find Changesets dialog box, and select the changeset you want.
  4. Click Get

    The local scripts folder has been updated to the changeset you selected.

  5. Using SQL Compare, set the local scripts folder as the source for a comparison, and the database as the target, then compare and synchronize.

    The database is updated to the revision you selected.

See also

Committing changes

Getting the latest version

Viewing source control logs / history

Undoing changes

Conflicts

Using SVN bug IDs & TFS work items

Using filters to exclude objects

Branching and merging

Was this article helpful?

Search support
Forums

SQL Source Control

all SQL products

all products