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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Design Quandry

Author  Topic 

Scott
Posting Yak Master

145 Posts

Posted - 2003-02-26 : 09:06:38
I am in 2 minds about a design decision.
I have a project table where I capture basic project information. I also have a project type table that I use to populate my drop-down list in my app.

What do I insert into the project table for project type, TypeID or the actual type "Water Project"?

There are 2 design considerations to be taken into account.
1) I capture the TypeID into the Project table. In the future that type of project is not allowed, must not be in the dropdown, so the user deletes that type from the Project types table. (referential integrity problems) I now have projects with TypeID 4 and who knows what kind of project that is.

2) I capture the actual Type to the database and just use the type table for the application dropdown lists. mmm...

I could just go with 1 and add a flag to the Type table so that when a user wants a given type deleted actualy the flag just changes. Sounds theoreticaly nice but is it worth all the effort?

Which is best practice? Opinions/Alternates please!
Thanks

nr
SQLTeam MVY

12543 Posts

Posted - 2003-02-26 : 09:37:20
Have a project ID rather than using the name - this means you you are able to change the project name.

Deleting - depends on how you want to delete. If you want to delete everything associated with the project and probably move it to an archive database then you don't need a flag, but it is easier to have the flag on the table.
You might want to call it active rather than deleted and maybe have a created and completed date.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -