Schedule a Data compare using a batch file

RichPRichP Posts: 5
Hi - does anyone know how to set up a batch file to schedule a Data Compare job in Windows. It worked with SQL Data Compare 6 but won't work with V8.

Thanks,

Richard

Comments

  • Hi Richard,

    What syntax are you using for your batch file?

    The syntax with SQL Data Compare 8 has now changed per the below link:

    http://www.red-gate.com/supportcenter/C ... 700052.htm

    If you want to post your batch file though I can have a look at it for you.

    Pete
    Peter Peart
    Red Gate Software Ltd
    +44 (0)870 160 0037 ext. 8569
    1 866 RED GATE ext. 8569
  • Hi Pete,

    The command line is:

    "C:\Program Files\Red Gate\SQL Data Compare 8\RedGate.SQLDataCompare.UI.exe" /compare "S36Admin_S46AdminReporting_Blobs_V8.sdc"
    Pause

    And I'm running from within a Scheduled Task. Thanks for your help.

    Cheers,

    Richard
  • Hi again Pete,

    After further investigation I've come to the conclusion that in V8 the following 3 commands do the same thing, namely open a blank project:

    "C:\Program Files\Red Gate\SQL Data Compare 8\RedGate.SQLDataCompare.UI.exe" /compare "D:\SQLDataCompare\S47CGD_PPIAdmin_S46CGD_PPIAdminReporting.sdc"
    "C:\Program Files\Red Gate\SQL Data Compare 8\RedGate.SQLDataCompare.UI.exe" /compare "S47CGD_PPIAdmin_S46CGD_PPIAdminReporting.sdc"
    "C:\Program Files\Red Gate\SQL Data Compare 8\RedGate.SQLDataCompare.UI.exe" /Project:"D:\SQLDataCompare\S47CGD_PPIAdmin_S46CGD_PPIAdminReporting.sdc"

    The following command does nothing:

    sqldatacompare /Project:"D:\SQLDataCompare\S47CGD_PPIAdmin_S46CGD_PPIAdminReporting.sdc"

    I really want to run these jobs using files I've created in the GUI, i.e at a high level. Any advice?

    I've gone back to using V6, as it does what I want......

    Cheers,

    Richard
  • Hi Richard,

    Per the below taken from the SQL Data Compare help file, the syntax for referencing a project should be:

    sqldatacompare /Project:"C:\SQLDataCompare\Projects\Widgets.sdc"

    To confirm, I have tested this on my machine creating a project in SQL Data Compare 8 and running the below through the command line:

    sqldatacompare /Project:"C:\Documents and Settings\Peter.Peart\My Documents\SQL Data Compare\SharedProjects\WidgetDev v WidgetLive.sdc"

    Once executed, this returns the following from CMD:

    C:\Program Files\Red Gate\SQL Data Compare 8> sqldatacompare /project:"C:\Documents and Settings\Peter.Peart\My Documents\SQL Data Compare\SharedProjects\WidgetDev v WidgetLive.sdc"

    Red Gate SQL Data Compare Command Line Utility V8.0.2.5
    ==============================================================================
    Copyright © Red Gate Software Ltd 1999-2009

    Serial Number: xxx-xxx-xxxxxx-xxxx

    Registering databases
    Mapping
    Comparing databases
    Finished

    Summary Information
    ===============================================================================
    DB1 = SLS-PETE\SQL2005.WidgetDev
    DB2 = SLS-PETE\SQL2005.WidgetLive

    Object type Name Records DB1 DB2
    Table [dbo].[Contacts] 7 <> <>
    Table [dbo].[WidgetDescriptions] 2 <> <>
    Table [dbo].[WidgetDescriptions] 1 <<
    Table [dbo].[WidgetPrices] 1 <> <>
    Table [dbo].[WidgetPrices] 3 >>
    Table [dbo].[WidgetPurchases] 854 <> <>
    Table [dbo].[WidgetPurchases] 10156 <<
    Table [dbo].[Widgets] 1 >>
    Table [dbo].[Widgets] 1 <<

    If I add the /synchronize switch after the original command then this also synchronizes the databases.

    Can you confirm if these project files have been opened through the GUI with SQL Data Compare 8 yet?

    Pete
    Peter Peart
    Red Gate Software Ltd
    +44 (0)870 160 0037 ext. 8569
    1 866 RED GATE ext. 8569
  • Hi Pete,

    Yes they've been opened and saved in V8.

    Richard
  • Hi Rich,

    What happens when you reference the project file through CMD? Does that run and is it just the batch file that is failing or is it both?

    Pete
    Peter Peart
    Red Gate Software Ltd
    +44 (0)870 160 0037 ext. 8569
    1 866 RED GATE ext. 8569
Sign In or Register to comment.