SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 29th, 2003, 12:16 AM
nickcwj nickcwj is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 1 nickcwj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to nickcwj
Question Synchronizing 2 tables with different field structure

Greetings everybody,

I am coding a PHP/PEAR:DB-based intranet application... using generic sql codes (no proprietary syntax as evident in MySQL or Sybase)... currently using MySQL as the db backend for testing on my local workstation... will be migrating to a Sybase db server when everything is up and running like clockwork.

Currently I'm trying to sync Mcinfo table and another table called EntityRelocation table. Basically these two tables are somewhat the same... the Mcinfo table being the master table and the EntityRelocation table being the secondary table. Theoretically, i am supposed to replicate any changes made in Mcinfo table directly into EntityRelocation table... provided that the fields for both tables are the same. However in this case, it is NOT...

** I have a php page with a "Sync Now!" button... whenever the user clicks this button, it will trigger all the sql codes to perform the table synchronization process **

Here's what's going on >>

1) We have equipment/machines labelled with invidual names defined in Mc_No field (e.g. SA23)

2) When we relocate a machine to another section within the area, we change the names of the machines (e.g. changing SA23 to SA19, SA19 to SA08 etc.)

3) However, the technicians who perform the actual relocation process will have to update McInfo table first.

4) But when it is time for data synchronization, all updated data would be replicated into EntityRelocation_tbl, which has a different data structure as compared to McInto table ...

** I have attached the sample SQL script, the db schema, and a diagram... all in a ZIP file. After you run the script, there will be sample data inside the mcinfo table. However, I left the entityrelocation_tbl table blank... to facilitate ease of inserting new fresh data during synch, and later comparing and updating the freshly inserted data when necessary.

>> The trouble I'm facing now is... how do I write the generic sql code from scratch to perform synchronization of tables having different field structures as depicted in the diagram (located in the attached zip file) ?

I just need to know how to code from scratch the synching process when entityrelocation_tbl is blank, and when entityrelocation_tbl already contains exisiting data.

Hope to hear from you all soon... thanks

Regards,
Nick
Attached Files
File Type: zip files.zip (24.2 KB, 268 views)

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Synchronizing 2 tables with different field structure


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway