• Steve Jones - Editor (7/20/2009)


    The thing I'd suggest is that you write two stored procedures, which is essentially two methods. Then if you want to build an abstraction, write a 3rd that takes both parameters, if only one comes in (check for NULL), call one proc, otherwise call the other.

    That seems like work, but if you build it up in your app, you're essentially doing the same thing. By encapsulating this into multiple procs, you can easily call them from other places, and also it is tune-able if more results or columns are needed.

    That seems like a good solution, but it would ultimately lead to a lot of duplicating a lot of the same code. But, maybe if I put all of the complex joins and temporary tables into a view and then use the various procedures to aggregate the data from the view I could avoid having to rewrite all the crap. That might be just what I need.