Click here to Skip to main content
15,911,360 members
Home / Discussions / Database
   

Database

 
GeneralRe: Design question - returning varying results Pin
Eric Dahlvang21-Sep-06 6:42
Eric Dahlvang21-Sep-06 6:42 
GeneralRe: Design question - returning varying results Pin
Judah Gabriel Himango21-Sep-06 8:35
sponsorJudah Gabriel Himango21-Sep-06 8:35 
GeneralRe: Design question - returning varying results Pin
Eric Dahlvang21-Sep-06 11:23
Eric Dahlvang21-Sep-06 11:23 
GeneralRe: Design question - returning varying results [modified] Pin
Eric Dahlvang22-Sep-06 3:26
Eric Dahlvang22-Sep-06 3:26 
GeneralRe: Design question - returning varying results Pin
Judah Gabriel Himango22-Sep-06 5:38
sponsorJudah Gabriel Himango22-Sep-06 5:38 
GeneralRe: Design question - returning varying results Pin
Eric Dahlvang22-Sep-06 6:17
Eric Dahlvang22-Sep-06 6:17 
GeneralRe: Design question - returning varying results Pin
Judah Gabriel Himango22-Sep-06 6:28
sponsorJudah Gabriel Himango22-Sep-06 6:28 
GeneralRe: Design question - returning varying results Pin
Scott Serl21-Sep-06 7:49
Scott Serl21-Sep-06 7:49 
Sometimes I use this kind of schema if I need something highly changeable (usually only when data columns are user-configurable):
Have your main Foo table, then have 1 table for foo-inheritor values. In the foo-inheritor table, you have a foreign key to the Foo table, a FieldName field and a Value field. Your stored procedure would return 1 result set for Foo, and another for the foo-inheritor. Your business object would load the individual field values from the foo-inheritor result set into the appropriate fields.

This model works best when only 1 Foo is queried at a time, but can also be used to return more than 1 (with slightly more effort in both the stored proc and the .net code). It is also more difficult if the values cannot be stored as character types, but you can add a Type field and store everything in varbinary if necessary, then convert when loading the objects.

I would definitely go with Eric's solutions if the tables aren't very dynamic, but this solution works when many foo-inheritors are expected to be added over time.

Scott


GeneralRe: Design question - returning varying results Pin
Judah Gabriel Himango21-Sep-06 8:39
sponsorJudah Gabriel Himango21-Sep-06 8:39 
GeneralRe: Design question - returning varying results Pin
Scott Serl21-Sep-06 9:03
Scott Serl21-Sep-06 9:03 
GeneralRe: Design question - returning varying results Pin
Judah Gabriel Himango21-Sep-06 10:00
sponsorJudah Gabriel Himango21-Sep-06 10:00 
GeneralRe: Design question - returning varying results Pin
Scott Serl21-Sep-06 10:27
Scott Serl21-Sep-06 10:27 
GeneralRe: Design question - returning varying results Pin
Judah Gabriel Himango21-Sep-06 18:01
sponsorJudah Gabriel Himango21-Sep-06 18:01 
QuestionRowFilter and Dataset Pin
Itanium21-Sep-06 2:28
Itanium21-Sep-06 2:28 
AnswerRe: RowFilter and Dataset Pin
Stephan Pilz21-Sep-06 21:06
Stephan Pilz21-Sep-06 21:06 
QuestionVisual Query Builder Pin
BadKarma21-Sep-06 2:09
BadKarma21-Sep-06 2:09 
QuestionSQL Server CURSOR Pin
choorakkuttyil21-Sep-06 2:07
choorakkuttyil21-Sep-06 2:07 
AnswerRe: SQL Server CURSOR Pin
_AK_21-Sep-06 3:34
_AK_21-Sep-06 3:34 
AnswerRe: SQL Server CURSOR Pin
Eric Dahlvang21-Sep-06 3:45
Eric Dahlvang21-Sep-06 3:45 
QuestionSQL server 2005 express edition Pin
NituC21-Sep-06 0:20
NituC21-Sep-06 0:20 
AnswerRe: SQL server 2005 express edition Pin
Dave Kreskowiak21-Sep-06 10:34
mveDave Kreskowiak21-Sep-06 10:34 
QuestionAccess Database Pin
V.20-Sep-06 23:48
professionalV.20-Sep-06 23:48 
AnswerRe: Access Database Pin
Rob Graham21-Sep-06 4:46
Rob Graham21-Sep-06 4:46 
GeneralRe: Access Database Pin
V.21-Sep-06 4:57
professionalV.21-Sep-06 4:57 
QuestionReset the Primary KEY Pin
vengaqua20-Sep-06 22:14
vengaqua20-Sep-06 22:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.