Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: Database: MS SQL Server
 An interesting migration issue !
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

laser
Advanced Member

Australia
3859 Posts

Posted - 06 October 2004 :  09:15:42  Show Profile
In the words of some great people : "There are no problems, only challenges",

Or my boss's words "Have I got a CHALLENGE for YOU!".

I will be attempting this challenge some time next week or the week after (the names have been changed to protect the innocent).

I have 2 completley separate Snitz forums on 2 different sites that I need to merge into one. Site #1 is running on Access (will be migrated to SQL Server as the first step). The second step is to take the site #2 forum db (running SQL Server) and append it to the newly created db for site #1. Here's where the problem starts, I will have duplicate cat_id's, Forum ID's, member id's, etc... Is there an easy way to make them unique (when compared to site #1), and then merge the 2 databases together ?

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 06 October 2004 :  12:20:10  Show Profile  Visit D3mon's Homepage
OMG! Find another job - quick!


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 06 October 2004 :  13:09:42  Show Profile  Send ruirib a Yahoo! Message
Without writing some code (either in T-SQL or a programming language) I don't see how you can do it. So, it's not an easy way, thought it's not that difficult a way, anyway.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 06 October 2004 :  13:33:14  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
Here's a quick & dirty example to get you started. Nothings been tested, so be sure to backup first.


--- add hold fields for old ids....
ALTER TABLE DB1.FORUM_MEMBER ADD OLD_MEMBER_ID int;
ALTER TABLE DB1.FORUM_CATEGORY ADD OLD_CAT_ID int;
ALTER TABLE DB1.FORUM_FORUM ADD OLD_FORUM_ID int;
ALTER TABLE DB1.FORUM_TOPICS ADD OLD_TOPIC_ID int;
ALTER TABLE DB1.FORUM_REPLY ADD OLD_REPLY_ID int;

--- start with members and category since those are the basic parent levels....
SELECT MEMBER_ID AS OLD_MEMBER_ID, M_STATUS, M_NAME, M_USERNAME, ... INTO DB1.FORUM_MEMBER
  FROM DB2.FORUM_MEMBER;

SELECT CAT_ID AS OLD_CAT_ID, CAT_STATUS, ... INTO DB1.FORUM_CATEGORY
  FROM DB2.FORUM_CATEGORY;

-- now work on the children...
SELECT C.CAT_ID, FORUM_ID AS OLD_FORUM_ID, F_STATUS INTO DB1.FORUM_FORUM
  FROM DB2.FORUM_FORUM F, DB1.FORUM_CATEGORY C
 WHERE F.CAT_ID = C.OLD_CAT_ID;

SELECT F.CAT_ID, F.FORUM_ID, TOPIC_ID AS OLD_TOPIC_ID, T_STATUS, ... INTO DB1.FORUM_TOPICS
  FROM DB2.FORUM_TOPICS T, DB1.FORUM_FORUM F
 WHERE T.FORUM_ID = F.OLD_FORUM_ID;

:
: REPEAT FOR ALL CHILDREN
:
- get rid of extra fields
ALTER TABLE DB1.FORUM_MEMBER DROP OLD_MEMBER_ID;
ALTER TABLE DB1.FORUM_CATEGORY DROP OLD_CAT_ID;
ALTER TABLE DB1.FORUM_FORUM DROP OLD_FORUM_ID;
ALTER TABLE DB1.FORUM_TOPICS DROP OLD_TOPIC_ID;
ALTER TABLE DB1.FORUM_REPLY DROP OLD_REPLY_ID;

Dave Maxwell
Barbershop Harmony Freak
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 06 October 2004 :  16:46:46  Show Profile
D3mon, yeah I feel like it but I don't see another way out of this one !

ruirib, code is required for sure - I'm just collecting ideas at the moment on where to start.

Dave, I don't expect anything to be tested, I think this one is a first ! Anyway, great idea on the "OLD_" fields, I was going to just execute a bunch of UPDATE commands to alter all the necessary IDs, but yeah it's a huge job!
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 06 October 2004 :  18:21:41  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
quote:
Originally posted by laser

Dave, I don't expect anything to be tested, I think this one is a first ! Anyway, great idea on the "OLD_" fields, I was going to just execute a bunch of UPDATE commands to alter all the necessary IDs, but yeah it's a huge job!



I had thought about that, but this way is actually a little easier. The trick is going to be identifying all the child tables so you're sure you're doing the inserts into the correct order. You can put it into one large stored proc and you should be fine.....

Dave Maxwell
Barbershop Harmony Freak
Go to Top of Page

Jeepaholic
Average Member

USA
697 Posts

Posted - 07 October 2004 :  00:15:08  Show Profile  Visit Jeepaholic's Homepage
I've done it. It's a big job, not to mention merging users into one user database, giving all the users new ID's and updating all the forum topics and replies to reflect the new user ID's. That, plus everything else spoken about thus far.

I used a lot of "Old_ID" field concepts. When you copy one table to a new one, always create this column and add the old ID's in for your reference and use later on in the migration. I used to have an outline of everything I did, but, I don't anymore or I'd share it. <sorry>

Don't forget, you might have folks who've signed up on both forums. So, you'll have to deal with figuring out which ID to keep for them, then converting the rest of the ID's...yada... LOTS to think about!

Al Bsharah
Aholics.com

Jeepaholics Anonymous
Broncoholics Anonymous
Network Insight
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 12 October 2004 :  06:52:28  Show Profile
Thanks for all the tips peoples, I'm still struggling to even gain to the Site #2 data so no real progress yet.

I'll let you know how I go.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.35 seconds. Powered By: Snitz Forums 2000 Version 3.4.07