Regular expression filters

Top  Previous  Next

You can apply regular expression filters to include or exclude databases matching a specific pattern.  One advantage of using regular expressions is that any new databases whose names matches the regular expression will be included (or excluded) in the list of databases to run your scripts on.  You do not have to continuously update your query groups to include new databases.

 

To use regular expression filters, you need to first open the Configure Query Server Filters window.  You do this by selecting the filtered item in the query group and clicking on the Edit button, or simply double-clicking on the filtered item.

 

regex_01

 

On the Configure Query Server Filters window, select the Use regular expression filters to select databases to run scripts on item.  Add as many include or exclude filters as you require.

 

query_group_12

 

 

Using 'include' filters

 

For example, let's say you only want to your scripts on all databases starting with the prefix prod and hr.  You should then add 2 include filters like this.

 

regex_02

 

In this way, any new databases with the prod and hr prefixes will be automatically included in the query group.

 

 

Using 'exclude' filters

 

If you use only exclude filters, SQL Multi Select will apply the exclude filters to the list of databases on that server.  For example, you don't want to run your scripts on the postgres and internal_logs databases.  Just create 2 exclude filters like this:
 

regex_03

 

 

Using 'include' and 'exclude' filters

 

Expanding on the example above, let's say you have development copies of the prodxxx and hrxxx databases, and they use a numeric suffix e.g. prod_01, hr_03 etc.  You don't want run your scripts on these databases.  To do this, add 2 include filters, and 2 exclude filters like this:

 

regex_04

 

The 2 include filters (+prod, +hr) will pick up all databases beginning with the prod and hr prefixes.  The 2 exclude filters (-prod_[0123456789], -hr_[0123456789]) will then exclude all database names with the prod_ and hr_ prefixes followed by a digit.