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)
 How do I store the results of selecting multiple checkboxes in SQL?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-03-24 : 07:43:43
dege writes "An html form asks the a user to select all that apply with about 10 options, each with its own checkbox. What is a good way to store the data in a SQL 2000 database? I thought about storing it as "A,C,F" where only the options that are select are stored, separated by commas. But I don't think that is really optimal for running reports and making future changes.

Is there a better way?

Thanks,
dege"

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-03-24 : 08:16:16
quote:

dege writes "An html form asks the a user to select all that apply with about 10 options, each with its own checkbox. What is a good way to store the data in a SQL 2000 database? I thought about storing it as "A,C,F" where only the options that are select are stored, separated by commas. But I don't think that is really optimal for running reports and making future changes.

Is there a better way?

Thanks,
dege"



you should have a seperate column for each option I am not sure but i think this would decrease the processing time and resources required during the report generation,still it dependson what kind of application it is.


Expect the UnExpected
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-03-24 : 09:16:43
quote:

...you should have a seperate column for each option...



If you want to normalize your data you should store it in a table that looks like ...

create table useroptions (
[user] <datatype> not null,
[option] <datatype> not null,
constraint pk_useroptions primary key clustered ([user],[optoin]) )

 
Moving your CSV column into seperate columns doesn't truely remove the repeating group. At least according to Fabian ... Joe may disagree ...

Jay White
{0}
Go to Top of Page
   

- Advertisement -