Applies to
ApexSQL Source Control

This article explains how to work with labels in ApexSQL Source Control.


Labels represents a snapshot of current state of all objects in source control repository. That state can be restored at later stage if there is a need for that. There is no limitation in number of created labels.

Labels are useful in case when some major changes will be done on the database, so that version can be reverted to a baseline if some issues appear.

It is also helpful for creating builds, so that a particular label can be tested and any subsequent changes won’t affect the integrity of the tested build.

Creating label can be done through the Object Explorer pane from the context menu, using the Create label option:

After clicked, the Label dialog appears:

Once the label is created, it is stored in the source control repository so it can be accessed by all developers.

A list of all existing labels can be accessed through the Object Explorer pane from the context menu, using the Show labels option:

The Get button is used to generate a script that will build/update the database to incorporate all changes from the selected label.

With this approach, a developer will see the generated SQL script which can be executed by immediately, by clicking the Apply button, saved as SQL file so it can be executed later, using the Save as button, or the script execution can be canceled:

If there are errors during script execution, those will be presented in the results dialog:

Quick tip icon

Quick tip:

Applying a label against a database can be accomplished only if the whole script is executed successfully. If there is at least one error, the transaction will rollback all changes

Once a database is restored all the differences between it and the current state of the source control repository will be shown on the Action center as any other change.


Q: If one developer creates a label, can others apply it?

A: Yes, it can be applied by any developer who has a database linked to the same repository.

Q: What source control systems does ApexSQL Source Control work with that support labels?

A: Labels are supported in all source control systems that are available through ApexSQL Source Control, which are: Git, Mercurial, Subversion, Perforce and Team Foundation Server.

Q: Can I get by label if the permissive or restrictive policy is set?

A: No. Applying the label is treated the same way as any other edit of database objects, so this wouldn’t be allowed, unless all objects that are affected by label are checked out, as requested by the policy.

Q: Who can delete a label, and how would they do it?

A: Anyone who has access to the repository with proper rights can delete a label.

Q: Can I see the exact script differences between objects in selected label and objects in a database, or objects between two labels?

A: You cannot do that from the ApexSQL Source Control but it can be done using ApexSQL Diff.

Q: Can I build a new database directly from a label? If so how?

A: Yes. It can be built using the ApexSQL Source Control by creating a new database, linking it to the same repository where the label is stored, and applying that label against the database. A database can also be built from label using ApexSQL Build, or ApexSQL Diff.

Q: Can I edit the comment in a label?

A: Not at this point. It will be possible in future releases, though.