Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 29th, 2004, 12:42 PM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Table Design Help

Hello,

I need some design help for one of my tables. My application consists of numerous tabs. A few of these tabs have a Submitted By drop-down. These drop-downs are populated using the entries in the Contacts table. Some of the rows from this table should only appear in the Submitted By drop-downs of particular tabs. How do I indicate which row should appear on which tab?

Here are my ideas:
Option 1) Add a new Tab column. In this column have a comma-separated list of the tabs on which this entry should appear in the drop-down.
Option 2) Add columns for each tab and then flag them as 'Y' or 'N' depending on whether or not that entry should appear in that tab's Submitted By drop-down.
Option 3) ???

Which is the better option and why? Is there some other option that is better than those?

Thanks for any help.

Donna

 
Old July 29th, 2004, 12:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

The drop-down fields, do they have the same values always, or mostly the same values?

Brian
 
Old July 29th, 2004, 01:04 PM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by bmains


The drop-down fields, do they have the same values always, or mostly the same values?
No, it is a list of people's names. For example, there might be a row for 'Joe Blow', but 'Joe Blow' should only appear on Tab 1 and Tab 2, but not Tab 3.

 
Old July 29th, 2004, 01:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I don't like either option. But if you want to use one of them the first is better.


My solution:

You have a Table of Contacts
You need a list/table of Tabs
You need a table of Contacts-Tabs

Each row in Contacts-Tabs would list a ContactID and a TabID.

Using this example:
Contact 1 can be on tab 1 and 3
Contact 2 can be on tab 2 and 3
Contact 3 can be on tab 1
Contact 4 Can be on tab 2

Your table would be:

ContactID TabID
    1 1
    1 3
    2 2
    2 3
    3 1
    4 2

Then you select ContactID for the proper TAB your on joined with the Contact table (which has an ID field right?!) so you can get the list of names for any specified tab.

Doing this you don't need to add more Columns if you add more tabs. You don't need to String build/split to find out which names you need (and loop through then) and you get to put the "selection" of the right data in the database, where it belongs... Rather than getting everything back and then figuring it out in code.


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee





Similar Threads
Thread Thread Starter Forum Replies Last Post
table design.. help please sarah lee SQL Server 2000 2 September 1st, 2006 01:35 PM
Help with SQL table(s) design wilburb SQL Language 0 February 22nd, 2006 07:35 PM
Table Design Error? pannet1 BOOK: Expert One-on-One Access Application Development 0 April 15th, 2005 10:47 AM
database table design problems leeegglestone Access 2 August 12th, 2004 12:55 PM
Java Design issue with UML and Design Patterns the_logical_way Apache Tomcat 0 May 31st, 2004 04:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.