How can we help you today? How can we help you today?

Can I use WHERE clause to filter data?

In SQL Data Compare, I am able to set a WHERE clause on a table to filter data that I don't want in the comparison.  I'd like to use this functionality in SCA to filter off local dev environment specific data from a table.  I'm not seeing an option for setting that.  Is it available?
PeterDaniels
0

Comments

6 comments

  • Russell D
    Hi Peter,

    If you are using SCA projects, then this should be doable using the option under Controlling data deployment with SQLCMD variables. See https://documentation.red-gate.com/sca3/developing-databases-using-sql-change-automation/generating-scripts-to-capture-database-changes/data-population for further information.

    If you're using SOC projects though, it's not possible to do this directly: however, instead of using Static Data, you could have an additional step calling sqldatacompare.exe.
    Russell D
    0
  • PeterDaniels
    Thank you, @Russell D
    I'm using SCA. I've read the SCA docs on data. That didn't quite get me there, though. I want to use a where clause filter in the SCA project, like I can do inside SQL data compare.
    PeterDaniels
    0
  • Russell D
    Hi @PeterDaniels , sorry this never actually popped up so I didn't realise you'd come back - did you ever get to the bottom of this or did you still need help?
    Russell D
    0
  • matpez
    Hi @Russell D,
    I have been using SCA through Visual Studio for a few years.
    I have 15 tables in DataSync but I need to set a where clause on one of them.
    It's possible to do it?
    matpez
    0
  • Danr
    @Russell D
    I also need to filter my static data with a where statement. I need all static data in a table where a specific column is null and push them to git. Is this possible with the change automation filters?
    @PeterDaniels , @matpez
    Did you found any solution?
    Danr
    0
  • matpez
    Hi @PeterDaniels,
    unfortunately I have not found any solution. And RedGate didn't let me know if this feature will be implemented in the future.

    Also I have some tables in static data where there is a column called "SysRecord". I would like to set a Where during the migration that retrieves only the records with SysRecord = 1

    Await news @Russell D?
    matpez
    0

Add comment

Please sign in to leave a comment.