Red Gate forums :: View topic - Using Underscores in a filter
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

Using Underscores in a filter

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
chadhattabaugh



Joined: 30 Apr 2014
Posts: 12
Location: Samtec

PostPosted: Tue Jul 15, 2014 7:38 pm    Post subject: Using Underscores in a filter Reply with quote

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

Is there a way to specify an underscore without it being interpreted as a wildcard?
Back to top
View user's profile Send private message
Evan Moss



Joined: 12 Jun 2013
Posts: 99

PostPosted: Thu Jul 17, 2014 11:21 pm    Post subject: Reply with quote

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


You can manually modify that to look like this:

Code:
<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
Back to top
View user's profile Send private message Send e-mail
chadhattabaugh



Joined: 30 Apr 2014
Posts: 12
Location: Samtec

PostPosted: Tue Jul 22, 2014 7:33 pm    Post subject: Reply with quote

This worked:

<Expression>(@NAME LIKE '\_%%' ESCAPE '\')</Expression>
Back to top
View user's profile Send private message
chadhattabaugh



Joined: 30 Apr 2014
Posts: 12
Location: Samtec

PostPosted: Wed Jul 23, 2014 3:25 pm    Post subject: Does not work in SSC Reply with quote

Interestingly, this works in SQLCompare 10.7 but not in Source Control 3.7.1
Back to top
View user's profile Send private message
Evan Moss



Joined: 12 Jun 2013
Posts: 99

PostPosted: Wed Jul 23, 2014 5:29 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
chadhattabaugh



Joined: 30 Apr 2014
Posts: 12
Location: Samtec

PostPosted: Tue Aug 05, 2014 8:56 pm    Post subject: Reply with quote

That worked. How is differecneFilter.xml applied if there is a filter stored in source control for a database?
Back to top
View user's profile Send private message
Evan Moss



Joined: 12 Jun 2013
Posts: 99

PostPosted: Wed Aug 06, 2014 4:24 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group