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 2008 Forums
 Transact-SQL (2008)
 Store CheckBoxList values (array) and then query

Author  Topic 

vspin
Starting Member

4 Posts

Posted - 2010-01-19 : 02:08:05
I have a CheckBoxList control (ASP.NET). My checkboxlist items all have a 2 character value. What's the best way to store this data so that I can search the column with the same CheckBoxList control?

The stored data would be an array (maybe a string with a delimiter?) and the search field would be an array as well. How do a query an array column with an array, effectively?


Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-19 : 02:17:31
It sounds like you'd need a lookup table with a char(2) column. I wouldn't store the data as a delimited string as that's not how relational databases are designed.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

vspin
Starting Member

4 Posts

Posted - 2010-01-19 : 03:45:45
tkizer,

Thank you very much. :))
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-19 : 12:55:11
You're welcome.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -