SQL Source Control 7

Exclude objects using filters

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

When you exclude an object with a filter, it isn't shown on the Commit 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's a set of objects that you never want to commit.

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, then select Other SQL Source Control tasks and click Edit filter rules.
  • On the Commit or Get latest tabs, right-click an object in the list of changes and click Edit filter rules.

The Edit filter rules tab 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  next to its name.

Example: excluding objects with a specific name or owner

To exclude all objects with 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, make sure 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 and won't appear in the Commit tab.

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 tab.

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

You don't have to commit the filter if you want different team members to have different filters.


Didn't find what you were looking for?