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 |
|
appzguy
Starting Member
1 Post |
Posted - 2006-06-09 : 15:24:00
|
| Quick question about design:We have an event which requires a lot of flags. Each event belongs to one customer. The flags describe the current processes that need to be handled for each event.Which is a better design?A table which will have one row with multiple columns for each flag.OrA table which will have multiple rows - one row for each flag.Any thing I should be on the lookout for before committing myself to one design? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-06-09 : 15:26:51
|
| second alternative. most versatile. also possible to store additonal meta data, such as apply date, confirmation date and so one... |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2006-06-09 : 16:05:34
|
| +1 for rowsIf you ever need more flags, it's easy to add a row. Adding columns and changing your application to handle that is more complicated. That coupled with the fact that a row in SQL server can only be 8000 bytes and I think you can only have 255 columns, means rows is probably a better choice.Michael<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
cmdr_skywalker
Posting Yak Master
159 Posts |
Posted - 2006-06-12 : 02:27:09
|
| what type of flags and how many flags do you have? if yes/no and less than 63, you can use just one column. There's a little trick about it but it works. Else, use the row, applying the metadata techniques (ie. table eventflags(eventid, flagname, flagvalue)).May the Almighty God bless us all! |
 |
|
|
|
|
|
|
|