Filtering database tables with same first two characters to compare

I have two SQL databases on the same server, and I only want to compare tables that start with t_ as the first two characters. How do I do that?

Answers

  • Hi @cgrissomatTFL

    This can be done after running a comparison between two databases in SQL Compare and by clicking the filters button located at the top. After clicking filters, you can scroll to the table filter, click the pencil icon next to it. This will open a "Edit filter rules" popup menu which you can enter your filter into.



    Regarding SQL Data Compare, there is no similar feature to be able to filter based on the table. The most you are able to do is type t_ in the search bar located at the top right, which does a blanket search of your tables/views to only include ones that have t_ in the name. Keep in mind this is more of a wildcard search, so it doesn't just look at the start of the name.


    Kind regards,

    Kurt McCormick
    Product Support Engineer, Redgate

    Need help? Take a look at our Help Center

  • The command line has more flexibility as the /include and /exclude switches take regular expressions, so you could consider using this if you have the right license.

    The \[ is to escape the implied square bracket in object names (needed to restrict the tables to those tables that start with t_

    sqldatacompare /s1:<server1> /db1:<db1> /s2:<server2> /db2:<db2> /include:identical /include:table:\[t_
    David Atkinson
    Product Manager
    Redgate Software
Sign In or Register to comment.