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 |
|
Callaway
Starting Member
16 Posts |
Posted - 2005-03-14 : 16:30:48
|
| Hi, I'm having a tough time trying to put this into words. Basically I have a simple search, but the page has checkboxes allowing users to select more than one Lesson Plan "topic." The search will go to the LessonPlanTopic crossref table and look for any number of topics.A sample search would be introductory lessons in "investments, taxes, exports."How do I search for multiple topicIDs in my stored proc? Is there a way to split them into ORs?Here is the sample search page so you understand my search:[url]http://www.collinedmond.com/powell/lessonsearch2.asp[/url]I’m midly proficient in SQL, but have never done a search this complicated before,Thanks in advanced guys; this site has been a god send for me, |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-03-14 : 16:37:12
|
@check1, ..., @checkN are your Checkbox values (checked = 1, unchecked = 0) that you pass as parameters to you sprocselect ...from ...where (condition1 and @check1 = 1) or (condition2 and @check2 = 1) or (condition3 and @check3 = 1) or (conditionN and @checkN = 1) Go with the flow & have fun! Else fight the flow |
 |
|
|
Callaway
Starting Member
16 Posts |
Posted - 2005-03-14 : 16:46:21
|
| I appreciate the quick reply, I actually started to set it up that way. The problem with the above code is that the values are dynamic; meaning topics can be added at anytime. I was going to name the checkboxes the same and generate a comma delimited string of topicIDs. Is that a basd choice? |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-03-14 : 16:51:21
|
well not really... your best bet is to use the csvToint aka split function and join to it.serach here for split or csvToint.Go with the flow & have fun! Else fight the flow |
 |
|
|
Callaway
Starting Member
16 Posts |
Posted - 2005-03-15 : 14:24:42
|
| Thanks for the kickstart, I just found this article:[url]http://www.sqlteam.com/item.asp?ItemID=11499[/url]This is exactly what I need to do, thanks for the pointer :) |
 |
|
|
|
|
|
|
|