> I am a developer and I have a problem trying to design a system to
> manage data coming from web surveys. Each section can potentially have
[quoted text clipped - 11 lines]
> foreign key pointing to a questions table and another column would hold
> the data (this is a simplified explanation.)
Yes, I would very much advocate this design.
> The problem with this is that now this column will have to accomodate
> all types of data, from bits to large varchars, and that field
> validation seems now impossible jeopardizing data integrity.
You could make that column sql_variant. This data type can fit any
other SQL Server data type except text, ntext and image.
In order to prevserve integrity, you can for each question define which
datatype that is correct for that question. In the trigger of the answers
table, you can check with sql_variant_property() that the data type is
correct.

Signature
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
JG - 30 Aug 2005 20:58 GMT
Erland,
thank you very much for your reply.
It is good to know this is the right way!
I didn't know about the sql_variant type so this is really helpful.
In my search I found a site that also seemed to confirm this design.
The interesting thing is they separate the free text answers from the
'pointer' answers (such as radio buttons, drop-downs, etc...), what
they call 'multiple-choice_questions':
http://www.databaseanswers.org/data_models/questionnaire_complex/index.htm
Jerry