
Converting dynamic query by example SQL to RDO based SQL Stored Procedure
Here is a challenge.
Currently, we have a Query by example screen allowing the user to
complete one or more fields from a base of twenty screen fields. We
run down the fields collection and build a dynamic sql statement based
on the fields that are filled in such as: Select onefield, twofield
.. from table1, table2 where onefield like 'value' and
another_integer_field = code ...
This all works fine! We actually perform the qbe in two parts,
returning only a count() from the query until the user determines that
the resulting set is acceptable (but not greater than 50).
Now we are moving from Access (used for modeling) to SQL Server and
would like to duplicate the functionality using stored procedures.
Unfortunately, I can't see any way to predefine a parameter stored
procedure that could accommodate the many possible combinations of
where clauses that can be generated by selecting one to many fields of
twenty possible. if all fields were strings I could use a large where
accommodating all fields with 'like' comparison and insuring the
non-completed fields are defaulted to * values. However, a number of
fields are integer codified DBCombo boxes.
Any ideas, or directions would be appreciated. BTW, environment is
VB4.0a enterprise w/ NT 3.51 and MS SQL Server.
Thanks