cmd, A <=> B, B to be B plus new+diff from A

austrianfoodispukeaustrianfoodispuke Posts: 100
edited October 27, 2008 9:19AM in SQL Compare Previous Versions
How can I create the syntax for this at a command line level:

Database A (exists as folders/scripts)
Database B (live db)

N.B. "A" is only a small subset of "B"

Compare A with B and sync them

Make B have anything new in A, plus any changes from A.
But do not drop things in B which are missing from A.

I've read the help, but unfortunately it is not clear to me.

Comments

  • Unfortunately this isn't currently possible via the SQL Compare command line. Someone has posted a Comparison SDK solution at http://www.red-gate.com/MessageBoard/vi ... php?t=7646, although I haven't tried this myself.

    There is an existing feature request in our system for this (SC-3478) so there is a chance that it gets addressed in a future release.

    Could you possibly give some background as to the nature of the objects you don't wish to drop on your target database? This information helps us design appropriate solutions.

    Thanks,

    David Atkinson
    Red Gate Software
    David Atkinson
    Product Manager
    Redgate Software
  • This sounds like it is more of a 'data compare' issue rather than a straight SQL Compare (the solution you have linked to)

    This is our set up:
    - 3rd party db, regular updates received
    - in house extensions (no 'combined' extensions e.g. we add a col to their table)

    What we are trying to achieve
    - Get prod backup
    - Put into dev, apply our extensions

    However, when running with the 'sync' flag, instead of having prod+extension, it drops all the prod stuff and I'm just left with the extensions.
  • So you're looking to not remove additional columns, rather than not dropping additional objects? Unfortunately SQL Compare doesn't treat columns as independent entities. We are however getting an increasing number of requests to allow the mapping of column names, as well as requests like yours to keep additional columns during a synch, so it's something that we'll hopefully get round to solving in a later release.

    However, the scope of the upcoming SQL Compare project is already fixed, so it will have to wait until the next one.

    Thannks for your comments. If I have in any way misunderstood your request, please let me know.

    David Atkinson
    Red Gate Software
    David Atkinson
    Product Manager
    Redgate Software
  • The database I mentioned will run standalone.

    The parts we add are not depended on by the standalone part.

    e.g. we might have views, procs, functions that use all this

    Perhaps think of it like a wrapper.

    There are releases from the 3rd party company (who someone else looks after) which are frequently applied to the db - we don't see this until it is in production.

    I want to take the latest version of the db (including any 3rd party updates) and add the latest verison of all of our 'extensions' currently under development'

    Everything appears to work, get the db, restore, get our code from source control, populate the tags.

    But when I do a sync between the newly copied version of prod (now in dev) and the scripts we have (ordered in folders), I'm not getting a combination of "prod+scripts" instead I just get "scripts". It is dropping everything that is not in the "scripts" folders.

    I don't understand why this should be as when using the GUI you can select from the 4 groups:
    Identical in A and B
    Only in A
    Only in B
    Different in A and B

    So why is using "/sync" causing it to drop stuff?
  • The /synch will make the target database the same as the source database. If it is missing in your scripts folder, it will assume that you want to drop these objects on the target. It is not yet possible to tell the sqlcompare.exe command line to filter out the groupings that appear in the UI from the synchronization. I agree that this is an inconsistency.

    As I said earlier, there is already a feature request for this (SC-3478) which may make it to the next version. However, due to prioritisation it is always possible that bugs and features miss a specific release so I can make no guarantee at this stage.

    However, even if we did implement this feature, and if you have a scenario where you have added a column to your customised table, and the target also has a new (but different) column added to the same table, SQL Compare will overwrite the target with the source.

    David Atkinson
    Red Gate Software
    David Atkinson
    Product Manager
    Redgate Software
Sign In or Register to comment.