SQL Source Control - 2.2

SQL Source Control

Learning SQL Source Control - 2.2

Using filters to exclude objects

You can create filters to exclude objects from SQL Source Control.

When you exclude an object with a filter, it is not shown on the Commit Changes tab, the Get Latest tab, or the Undo Changes dialog box. This means you can never commit, get, or undo an excluded object.

This is useful, for example, if there is a set of objects that you never want to commit, or consider for source control purposes.

Creating and editing filters

There are two ways to create or edit your filter:

  • In the Object Explorer right-click a database, folder, or object, select Other SQL Source Control Tasks, and click Edit Filter Rules...

    The Edit Filter Rules dialog box is displayed.

  • On the Commit Changes or Get Latest tab, right-click an object in the list of changes, and click Edit Filter Rules...

    The Edit Filter Rules dialog box is displayed.

The Edit Filter Rules dialog box lets you specify exclusion or inclusion conditions for individual objects or all object types:

You can exclude object types using the check boxes in the left-hand pane, or build more complex conditions by specifying AND clauses and OR conditions in the right-hand pane.

When you create a filter rule, its conditions are displayed in the left-hand pane, under the name of the object type it applies to:

To clear the filter rule for an object type click the (Clear) button next to its name.

Sharing filters

You can commit your filter to source control, and get the latest version when it changes.

This is useful for teams that want to exclude a set of objects across an entire development project.

When you create or edit a filter, SQL Source Control shows it on the Commit Changes tab:

You can see the differences between your current filter and the version in source control.

Example: excluding objects with a specific name or owner

If you never want to commit changes to any tables that have names beginning with Marketing, or any owned by the schema Marketing, regardless of their names:

  1. In the Object Explorer, right-click the database, select Other SQL Source Control Tasks, and click Edit Filter Rules...

    The Edit Filter Rules dialog box is displayed.

  2. In the box, ensure Exclude if is selected
  3. Under Property, select Object name.
  4. Under Operator, select Begins with.
  5. Under Value, type Marketing.
  6. Click

    A new OR condition becomes available.

  7. Under Property, select Schema name.
  8. Under Operator, select Equals.
  9. Under Value, type Marketing.
  10. Click Save and close.

The filter is applied. All objects owned by the schema Marketing, or with names that begin with Marketing are excluded by SQL Source Control.

You can commit the filter if you want to share it with the rest of the development team.

See also

Committing changes

Getting the latest version

Was this article helpful?

Search support
Forums

SQL Source Control

all SQL products

all products