Question

I've a couple of saved projects that I'm using from the command line to compare a database with TFS. One of my databases has a large number of asp.net related tables which all include "aspnet" in the table name, and I'm trying to filter these out.

I created the filter via the gui in the .scp file, but it seems as if it isn't picked up. (Extract from the scp file..)

<Table version="1"> 
  <Include>False</Include> 
  <Expression>(@NAME LIKE 'xx%') OR (@NAME LIKE 'aspnet%')</Expression> 
</Table> 

I've then created a separate filter again through the GUI, and am calling it from the command line with the /filter switch, but again it isn't being used. (extract from the .scpf file)

<Table version="1"> 
  <Include>False</Include> 
  <Expression>(@NAME LIKE 'xx%') OR (@NAME LIKE 'aspnet%')</Expression> 
</Table> 

If I change the /filter switch to point to a non-existent file it does error, so presumably it is using the filter switch, and indeed it is listed in the output..

Argument /filter has value 'DatabaseNameFilter.scpf' 

What am I missing here please?

Here's the full commandline

"C:\Program Files (x86)\Red Gate\SQL Compare 10\sqlcompare.exe" /project:"C:\Users\CIUser\Documents\SQL Compare\SharedProjects\MyDB (Head) v MyDB.scp" /assertidentical /password1:mypassword /include:identical /Report:myreport.html /ReportType:Simple /Options:Default,ForceColumnOrder,IgnoreCollations,oec,IncludeDependencies /verbose /force /filter:MyFilter.scpf >f.txt 
Was it helpful?

Solution

Looks like if you explicitly select an object in the UI and save the SQL Compare project, that will override the filter. For instance, using the sample databases, create a project and select all objects for inclusion, and save the project. Create a new filter and exclude objects ending in "Prices" and save the filter. The report will then contain the table "WidgetPrices" when you create it using the command line using the project + the filter.

Go back to the project, turn off the filter and de-select the WidgetPrices table so it is no longer included in the project and save it, then run the command-line again with that project and WidgetPrices is no longer in the report.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top