Using Underscores in a filter

chadhattabaughchadhattabaugh Posts: 19
edited August 6, 2014 11:24AM in SQL Compare Previous Versions
We rename tables with "_" before we physically remove them.

Is there a way to specify an underscore without it being interpreted as a wildcard?

Comments

  • 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:
    <Expression>(@NAME LIKE '_%')</Expression>
    

    You can manually modify that to look like this:
    <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
  • This worked:

    <Expression>(@NAME LIKE '\_%%' ESCAPE '\')</Expression>
  • Interestingly, this works in SQLCompare 10.7 but not in Source Control 3.7.1
  • 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
  • That worked. How is differecneFilter.xml applied if there is a filter stored in source control for a database?
  • 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
Sign In or Register to comment.