>Hmm. I was just thinking that you could pass in the parameters 'as is' to a single SP and build up the query there based on the values passed (or not passed) but, at first glance, you might need 2 sp's - one for the 2,4 case and one for the other ? May not be worth it at this point....
I created two separate SPs (for 2,4 and other case). I could have have just one 1 SP (this sp would have called these two SPs) and do all logic in SP, but I've decided to follow (partially) original VFP code and perform first part of the logic outside the SP.
If it's not broken, fix it until it is.
My Blog