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: General / Classic ASP versions(v3.4.XX)
 Re-number topic_ids
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

StephenD
Senior Member

Australia
1044 Posts

Posted - 18 November 2006 :  22:45:37  Show Profile  Send StephenD a Yahoo! Message
I need some help renumbering all my topic_ids in my db. I have a new table [MERGE] populated with TOPIC_ID_OLD and TOPIC_ID_NEW.

I have no archived, moderated or subscribed topics. 4000 topics and 40,000 replies.

I'm thinking the best way to go about this is to add a new column to FORUM_TOPICS and FORUM_REPLY called TOPIC_ID_NEW

I populate this column from my MERGE table:
UPDATE FORUM_TOPICS SET TOPIC_ID_NEW = FT.TOPIC_ID_NEW FROM MERGE FT WHERE FORUM_TOPICS.TOPIC_ID = FT.TOPIC_ID_OLD

Do the same with the FORUM_REPLY Table

I then turn off the relational primary key for TOPIC_ID in FORUM_TOPICS and FORUM_REPLY.

I then rename TOPIC_ID in both tables to TOPIC_ID_OLD and rename TOPIC_ID_NEW to TOPIC_ID.

I then reset the primary key fields for both these columns... this is where I need help. I remember trying to do this in the past and running into trouble with the indexes. Can anyone please let me know if what I have posted is the best way to do this so far and offer advice/instructions on the last part.

Thanking you in advance..
Cheers

StephenD
Senior Member

Australia
1044 Posts

Posted - 18 November 2006 :  23:08:11  Show Profile  Send StephenD a Yahoo! Message
Actually, looking at it now it might be better to make the temporary new fields in FORUM_TOPICS and FORUM_REPLY = the old topic_IDs (TOPIC_ID_OLD) then UPDATE FORUM_TOPICS SET TOPIC_ID = FT.TOPIC_ID_NEW FROM MERGE FT WHERE FORUM_TOPICS.TOPIC_ID_OLD = FT.TOPIC_ID_OLD
Go to Top of Page

StephenD
Senior Member

Australia
1044 Posts

Posted - 19 November 2006 :  00:49:46  Show Profile  Send StephenD a Yahoo! Message
Ok I've done all of the above and ran setup.asp and my forum seems to be running fine except for the missing indexes in FORUM_TOPICS and FORUM_REPLY. Any SQL available to add them back in manually? I'm browsing setup.asp right now but the lines for the indexes are a bit beyond my abilities.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 19 November 2006 :  01:55:42  Show Profile  Send ruirib a Yahoo! Message
You mean all the indexes for those tables?


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

StephenD
Senior Member

Australia
1044 Posts

Posted - 19 November 2006 :  02:30:02  Show Profile  Send StephenD a Yahoo! Message
Yes, at the moment I'm only seeing PK_FORUM_TOPICS as an index in FORUM_TOPICs instead of the Snitz C8?? etc
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 19 November 2006 :  13:26:46  Show Profile  Send ruirib a Yahoo! Message
You should be able to execute this from EM to create the indexes...


CREATE NONCLUSTERED INDEX [FORUM_FORUM_ID] ON [dbo].[FORUM_REPLY] 
(
	[FORUM_ID] ASC
)
Go
CREATE NONCLUSTERED INDEX [FORUM_REPLY_CATFORTOP_ID] ON [dbo].[FORUM_REPLY] 
(
	[CAT_ID] ASC,
	[FORUM_ID] ASC,
	[TOPIC_ID] ASC
)

GO

CREATE NONCLUSTERED INDEX [FORUM_REPLY_ID] ON [dbo].[FORUM_REPLY] 
(
	[REPLY_ID] ASC
)GO

CREATE NONCLUSTERED INDEX [FORUM_REPLY_R_AUTHOR] ON [dbo].[FORUM_REPLY] 
(
	[R_AUTHOR] ASC
)
GO

CREATE NONCLUSTERED INDEX [FORUM_REPLY_TOPIC_ID] ON [dbo].[FORUM_REPLY] 
(
	[TOPIC_ID] ASC
)
GO

CREATE NONCLUSTERED INDEX [FORUM_FORUM_ID] ON [dbo].[FORUM_TOPICS] 
(
	[FORUM_ID] ASC
)
GO

CREATE NONCLUSTERED INDEX [FORUM_TOPICS_CAT_FOR_TOP] ON [dbo].[FORUM_TOPICS] 
(
	[CAT_ID] ASC,
	[FORUM_ID] ASC,
	[TOPIC_ID] ASC
)
GO

CREATE NONCLUSTERED INDEX [FORUM_TOPICS_CAT_ID] ON [dbo].[FORUM_TOPICS] 
(
	[CAT_ID] ASC
)GO

CREATE NONCLUSTERED INDEX [FORUM_TOPICS_CAT_ID_FORUM_ID] ON [dbo].[FORUM_TOPICS] 
(
	[CAT_ID] ASC,
	[FORUM_ID] ASC
)GO

CREATE NONCLUSTERED INDEX [FORUM_TOPICS_T_AUTHOR] ON [dbo].[FORUM_TOPICS] 
(
	[T_AUTHOR] ASC
)
GO

CREATE NONCLUSTERED INDEX [FORUM_TOPICS_TOPIC_ID] ON [dbo].[FORUM_TOPICS] 
(
	[TOPIC_ID] ASC
)
Go


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

StephenD
Senior Member

Australia
1044 Posts

Posted - 19 November 2006 :  17:58:21  Show Profile  Send StephenD a Yahoo! Message
Thanks Rui!
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 19 November 2006 :  21:50:58  Show Profile  Send ruirib a Yahoo! Message
You're welcome.


Snitz 3.4 Readme | Like the support? Support Snitz too
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 1.89 seconds. Powered By: Snitz Forums 2000 Version 3.4.07