Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Sybase > synchronize 2 tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-20-07, 10:23
ymho ymho is offline
Registered User
 
Join Date: Jul 2006
Posts: 84
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
Reply With Quote
  #2 (permalink)  
Old 11-21-07, 04:46
Martijnvs Martijnvs is offline
Who? Me?
 
Join Date: Jan 2004
Location: The Hague/Utrecht, NL
Posts: 274
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!
Reply With Quote
  #3 (permalink)  
Old 11-21-07, 10:56
ymho ymho is offline
Registered User
 
Join Date: Jul 2006
Posts: 84
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,
Reply With Quote
  #4 (permalink)  
Old 11-22-07, 11:32
trvishi trvishi is offline
Registered User
 
Join Date: Sep 2003
Location: Switzerland
Posts: 371
Another option is to use sqsh. You can do select statements and redirect the output to bcp thro sqsh. A lot faster than inserts.
Reply With Quote
  #5 (permalink)  
Old 11-22-07, 11:48
ymho ymho is offline
Registered User
 
Join Date: Jul 2006
Posts: 84
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?
Reply With Quote
  #6 (permalink)  
Old 11-24-07, 12:24
trvishi trvishi is offline
Registered User
 
Join Date: Sep 2003
Location: Switzerland
Posts: 371
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On