Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Onamuji
Aged Yak Warrior
504 Posts |
Posted - 2003-04-15 : 12:07:33
|
| Well, what do you think? Pros/Cons please :) I have my doubts, but they may just be unneeded jitters... Assuming that in no single forum their shouldn't be a thread topic created with the same topic at a single instance of time ... would it be simplier/safer just to use an IDENTITY column? hrrmm... MEDIC!CREATE TABLE dbo.ForumThreads( ReplyForum VARCHAR(64) NOT NULL, ReplyCategory VARCHAR(64) NOT NULL, ReplyUser VARCHAR(64) NOT NULL, ReplySubject VARCHAR(64) NOT NULL, ReplyDateCreated DATETIME NOT NULL, Forum VARCHAR(64) NOT NULL, Category VARCHAR(64) NOT NULL, [User] VARCHAR(64) NOT NULL, Subject VARCHAR(64) NOT NULL, Body TEXT NOT NULL, DateCreated DATETIME NOT NULL, DateLastModified DATETIME NOT NULL, CONSTRAINT ForumThreads_PK PRIMARY KEY CLUSTERED (Forum, Category, [User], Subject, DateCreated), CONSTRAINT ForumThreads_Reply_FK FOREIGN KEY (ReplyForum, ReplyCategory, ReplyUser, ReplySubject, ReplyDateCreated) REFERENCES dbo.ForumThreads(Forum, Category, [User], Subject, DateCreated), CONSTRAINT ForumThreads_Forum_FK FOREIGN KEY (Forum, Category) REFERENCES dbo.Forums(Name, Category), CONSTRAINT ForumThreads_User_FK FOREIGN KEY ([User]) REFERENCES dbo.Users(Name), CONSTRAINT ForumThreads_Subject_CK CHECK (LEN(Subject) > 0))/* UPDATE** I forgot the user information, duh...*/ Edited by - onamuji on 04/15/2003 12:16:10 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-04-15 : 12:35:53
|
| I would use an identity for a post or topic or forum. It's just easier. even SQLTeam uses ID's for topics and forums and all that!A post or a forum or a topic is something YOU are defining as the application developer; it does not exist anywhere in the real world other than in your project. You are deciding what properties to assign, how to assign them, etc. If you decide that for every post or topic or whatever you would like to assign a unique numeric key, then by all means go ahead and do so; having decided upon that, I would use an identity because that's a nice easy way for SQL to generate that key for you.- Jeff |
 |
|
|
Onamuji
Aged Yak Warrior
504 Posts |
Posted - 2003-04-15 : 12:41:26
|
| bah ... this is what i get for not having any real projects to do ... playing with theories on how to do things differently that would somehow increase its productivty (speed,integrity,etc) ... i need a good example of a logical model for a threaded discussion forum ... hmmm ... so that the "others" don't go sequence happy with every entity/table ... its a tough thing, writing company standards for application architectures for a multitude of language/programming concepts ... |
 |
|
|
|
|
|
|
|