Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2006
    Posts
    115

    Unanswered: synchronize 2 tables

    i need to synchronize a slave table from master table daily. i would like to create "timestamp" and compare their values... does it work?

    pros & cons

    thx

  2. #2
    Join Date
    Jan 2004
    Posts
    545
    Provided Answers: 4
    If the 2 tables have an identical structure, you can truncate the slave-table, bcp-out the master-table and bcp-in in the slave table.
    I'm not crazy, I'm an aeroplane!

  3. #3
    Join Date
    Jul 2006
    Posts
    115
    same structure ... but the table size is large(4G data + 3G for 4 indexes + around 20,000,000 records) ... so seems cant drop index, truncate, bcp out & in & recreate indexes in short time,

  4. #4
    Join Date
    Sep 2003
    Location
    Switzerland
    Posts
    443
    Another option is to use sqsh. You can do select statements and redirect the output to bcp thro sqsh. A lot faster than inserts.

  5. #5
    Join Date
    Jul 2006
    Posts
    115
    Quote Originally Posted by trvishi
    Another option is to use sqsh. You can do select statements and redirect the output to bcp thro sqsh. A lot faster than inserts.
    can you show me the sample with command?

  6. #6
    Join Date
    Sep 2003
    Location
    Switzerland
    Posts
    443
    1> SELECT customer_id, item, SUM(qty)
    2> FROM orders
    3> GROUP BY customer_id, item
    4> \bcp -S SYB_DSS shipping.dbo.order_summary

    Check http://www.sqsh.org/sqsh_features.html

    You need to download sqsh in your environment if you havent already. Its free GNU based.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •