Generating Dynamic Query for Ad-Hoc Reports
Hello,
What is the best way to create a dynamic query to generate ad-hoc reports? I have a couple of ideas but not sure which would work best and be most flexible.
I would like our users to be able to check checkboxes for what data they would like returned in their report. The data would be pulled from a number of tables, 10+, depending on what pieces of data they checked.
- Should I write one dynamic query, with a bunch of IF statements in it?
- Should I write many individual queries and then join them together in a temp query?
- Should I create a temp table on our SQL server which contains the data from all of the tables; then query that? (I am worried about data being out-of-date with this option.)
Which one of these solutions should I go with or is there a better solution that I am not considering?
Thanks for the help.
Josh
