To save memory, can I loop through tables to sync the data?

seeriussseeriuss Posts: 3
I'm using Data Compare to sync the production data back to the development machine. Our dev machine doesn't have quite enough drive space to accommodate a whole script of our database sync. Is there a way to loop over the tables and sync them one at a time?

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    I don't know if this will save you any space, but we sure can try! Here is a DOS command that can use sqlcmd.exe to get a list of tables, then run SQL Data Compare command-line against each table, one at a time.
    for /F %i in ('sqlcmd -S MyComp\MyInst -d database1 -h -1 -Q "SET NOCOUNT ON; SELECT name from sysobjects WHERE XTYPE='U'"') do sqldatacompare /s1:MyComp\MyInst /db1:database1 /db2:database2 /s2:MyComp\MyInst /include:table:\[%i\]
    
    In the User Interface, it's easy to select the table you want to compare using the tables and views tab.

    If you can stuff a big drive in the computer, you can also set the RGTEMP environment variable to point to the new drive.
  • I have to agree. That sets a record for the best DOS command ever written! Red Gate Rocks!
Sign In or Register to comment.