Unfortunately I am in a situation where we need to generate dynamic SQL to provide results based on parameters passed into either the SPROC of the code itself to take into consideration.
6 drop down lists.
Each list somewhat cascades but they work independently. For instance:
These are SEPERATE drop down lists. Each one has a list of items with ID's.
When selected, they need to perform a query and dynamically join into their respective tables to bring back results.
They need to bring back results for the drop down items for those which are NOT selected. The catch is that ANY ONE of the lists could be selected with ANY OTHER combination (or on its own completely) i.e:
Brand AND TRA
TRA AND Pattern AND Ply
Ply AND Compound AND Brand
Then for the ones which are not chosen (the drop down list values), I have to execute IT's query using the values chosen from above (i.e if you select brand and TRA, i need to query for ply, compound, TRA etc...)
what is the best way of tackling this type of problem? How can I easily (at most?) Generate the dynamic SQL without figuring out all the possibilities in a case by case basis which will take a VERY long time.