Using Underscores in a filter

Compares and synchronizes SQL Server databases, backups and scripts.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, eddie davis, Anu Deshpande, Michelle Taylor, alice.easey, james.billings, chengvoon.tong

Using Underscores in a filter

Postby chadhattabaugh » Tue Jul 15, 2014 7:38 pm

We rename tables with "_" before we physically remove them.

Is there a way to specify an underscore without it being interpreted as a wildcard?
chadhattabaugh
 
Posts: 12
Joined: Wed Apr 30, 2014 9:23 pm
Location: Samtec

Postby Evan Moss » Thu Jul 17, 2014 11:21 pm

Hi Chad,

Unfortunately there's no easy way to do this, but I just came up with a workaround.

If you create a filter rule for excluding objects starting with '_', then save the filter, that will actually create a filter file located in "%userprofile%\\Documents\\SQL Compare\\Filters". If you open up that file in notepad, you'll see a statement like the following:

Code: Select all
<Expression>(@NAME LIKE '_%')</Expression>


You can manually modify that to look like this:

Code: Select all
<Expression>(@NAME LIKE '\\_%' ESCAPE '\\')</Expression>


Then save the filter file.

Once the filter file is saved, go back into SQL Compare, open up the filter dropdown, and select "open filter from file". Load the file you just modified and it should now filter out all objects starting with '_'.

Hope that helps.

Thanks,
Evan
Evan Moss
Product Support
(866) 627-8107
Evan Moss
 
Posts: 99
Joined: Wed Jun 12, 2013 9:56 pm

Postby chadhattabaugh » Tue Jul 22, 2014 7:33 pm

This worked:

<Expression>(@NAME LIKE '\\_%%' ESCAPE '\\')</Expression>
chadhattabaugh
 
Posts: 12
Joined: Wed Apr 30, 2014 9:23 pm
Location: Samtec

Does not work in SSC

Postby chadhattabaugh » Wed Jul 23, 2014 3:25 pm

Interestingly, this works in SQLCompare 10.7 but not in Source Control 3.7.1
chadhattabaugh
 
Posts: 12
Joined: Wed Apr 30, 2014 9:23 pm
Location: Samtec

Postby Evan Moss » Wed Jul 23, 2014 5:29 pm

Hello,

I just got this to work with SQL Source Control. You have to modify the DifferenceFilters.xml file in "%userprofile%\\AppData\\Local\\Red Gate\\SQL Source Control 3". For some reason this doesn't apply right away (there might be some sort of cache), but if you close and open SSMS it seems to work.

Hope that helps.

Thanks,
Evan
Evan Moss
Product Support
(866) 627-8107
Evan Moss
 
Posts: 99
Joined: Wed Jun 12, 2013 9:56 pm

Postby chadhattabaugh » Tue Aug 05, 2014 8:56 pm

That worked. How is differecneFilter.xml applied if there is a filter stored in source control for a database?
chadhattabaugh
 
Posts: 12
Joined: Wed Apr 30, 2014 9:23 pm
Location: Samtec

Postby Evan Moss » Wed Aug 06, 2014 4:24 pm

There should be a "filter.scpf" stored in your source control repository. In dedicated model, you should be able to modify that directly, then unlink/relink to source control and get latest. In shared model, it might be a bit trickier -- I think you'll have to do a manual modification in both the repository and the local differencefilter.xml.
Evan Moss
Product Support
(866) 627-8107
Evan Moss
 
Posts: 99
Joined: Wed Jun 12, 2013 9:56 pm


Return to SQL Compare 10

Who is online

Users browsing this forum: No registered users and 0 guests