With scripts,Unable to do datacompare without mapping tables

Hi,

I am encountering below error when trying to run this .bat deployment script:


DeployToTest.bat:


"C:\Program Files\Red Gate\SQL Compare 8\SQLCompare.exe" /scr1:"C:\Ravi_SFHP\_VSTS_2008_SFHP\VSTS_2008_SourceControl\DEV\MyWebCalc\ScriptsFolder" /Server2:"SRTTFS01v" /db2:"MyWebCalcDB_QA" /o:Default /force /Report:"C:\Ravi_SFHP\_VSTS_2008_SFHP\VSTS_2008_SourceControl\DEV\MyWebCalc\ScriptsMisc\OutputFiles\SchemaMigrateReport_LocalscriptsToQADB.html" /ReportType:Interactive /ScriptFile:"C:\Ravi_SFHP\_VSTS_2008_SFHP\VSTS_2008_SourceControl\DEV\MyWebCalc\ScriptsMisc\OutputFiles\SchemaMigrateScript_LocalscriptsToQADB.sql" /v > "C:\Ravi_SFHP\_VSTS_2008_SFHP\VSTS_2008_SourceControl\DEV\MyWebCalc\ScriptsMisc\OutputFiles\SchemaMigrate_LocalscriptsToQADB.txt" /sync

"C:\Program Files\Red Gate\SQL Data Compare 8\SQLDataCompare.exe" /scr1:"C:\Ravi_SFHP\_VSTS_2008_SFHP\VSTS_2008_SourceControl\DEV\MyWebCalc\ScriptsFolder" /Server2:"SRTTFS01v" /db2:"MyWebCalcDB_QA" /o:Default /force /ScriptFile:"C:\Ravi_SFHP\_VSTS_2008_SFHP\VSTS_2008_SourceControl\DEV\MyWebCalc\ScriptsMisc\OutputFiles\DataMigrateScript_LocalscriptsToQADB.sql" /v > "C:\Ravi_SFHP\_VSTS_2008_SFHP\VSTS_2008_SourceControl\DEV\MyWebCalc\ScriptsMisc\OutputFiles\DataMigrate_LocalscriptsToQADB.txt" /sync


Error in “DataMigrate_LocalscriptsToQADB.txt”:


Red Gate SQL Data Compare Command Line Utility V8.0.2.5

==============================================================================

Copyright c Red Gate Software Ltd 1999-2009

TRIAL STATUS: You have 13 days left in your trial.

Unlicensed Trial

SQL Data Compare running with SQL Option: Default (OK).

Comparing database Scripts.ScriptsFolder with database SRTTFS01v.MyWebCalcDB_QA...

Registering databases

Mapping

Comparing databases

Error: The selected objects are identical or no objects have been selected in the comparison.


The first part of .bat deployment script (i.e., schema compare script) executed without errors. The second part of .bat deployment script (i.e., data compare script) did not migrate data from source to target tables and also did not generate DataMigrateScript_LocalscriptsToQADB.sql output file.

Based on error, I am guessing that the error is caused due to non-specification of source-target table mapping. However I want the script to compare all tables/views/etc., of source to target based on identical names and migrate data to target. Can you please advise me how to specify this using command line interface?

Thanks,

Ravi

Comments

  • Hi,
    I am calling this command script in Visual Studio 'Tools' menu. I don't want to call Data Compare GUI from command script since this script is supposed to directly deploy 'scripts folder' scripts to QA database. I want "SQL Data compare" to compare 'script folder' to database based on default mapping if no mapping is specified. Is this functionality possible? This functionality is critical for me to recommend my management to purchase Prof edition of SQL Compare and SQL Data Compare in our organization. We already have standard editions of both of them.

    In one of your help files (http://downloads.red-gate.com/HelpPDF/C ... LTools.pdf), the "scripts folder"-to-database script is specified in Page 9.

    The second portion of this script is what I have implemented in email which I sent earlier. It is not working. To test this functionality, I am using a simple database with two tables (1st table with two columns, 2nd table with 1 column) and two rows in each table. The "schema compare" recreated the two tables in QA database from 'scripts folder' successfully. However the "data compare" did not recreate the two rows in each table and instead gave this error.

    Error: The selected objects are identical or no objects have been selected in the comparison.

    The same error is specified in my earlier email. Can you please answer me ASAP?

    Thanks,
    Ravi
  • Thanks for your post.

    My initial suspicion is that SQL Data Compare was unable to automatically map the tables together.

    SDC can only automatically map the tables if the table contains a PK, unique index or unique constraint. If the table doesn't have one of these set then SDC doesn't know what to use for a comparison key, and leaves it up to you to choose one.

    If this is the case, then the easiest way to get round this will be to set up a GUI project where you set all the custom comparison keys, and then call the GUI project file from the command line. e.g. sqldatacompare /project:myProject.sdc /sync

    You set the comparison keys in the 'Tables & Views' tab.

    I hope this helps.
    Chris
Sign In or Register to comment.