25th July 07:27
filtering data from
I have one big table with 190 columns (!), there are user's data stored in
Now, there is a form on which i can select criteria (around 30) for
filtering users, not all criteria must be selected, so never know how many
and what criterions are chosen.
What would be the best way to implement the selection of users from my
We have some ideas:
1) a.create one temporary table and insert there all users
b.for every criterion available from application form create one stored
procedure which would choose users not satisfying that criterion and remove
them from temp table, the procedure would be run only if criterion is
selected on the form
but this idea has some bad points: the table should not probably has an
index it would be slow to find records in such table and the problem with
defragmentation would appear here probably
2) create a procedure which would generate dinamically a where clause
depends on selected criteria passed to the procedure as parameters
but what happens if dinamically created statement exxceeds 8000 characters?
And which one would be faster?
Please advise, or maybe somebody would have some other ideas how this could