In my company's web site there are search pages for allowing users to search info on one or more tables (or in my case a select with 10 joins). Often the requirements for these search pages change over time with users either requesting additional columns to search or remove columns that are no longer useful.
The search page that the script is based on looks like this...
Date received |______|
Area |_______|
Source of budget |______|
[Submit]
I came up with the following stored proc to grab results from the source table w/c still allows me flexibility when it came to adding or removing searchable columns.
The script will work but it heavily depends on having an identity key on the source table and it is necessary to be mindful of the no. of columns used in the table variable so as not to downgrade performance.
At first the delete statements will seem hard to understand then when you get the hang of it you'll appreciate the flexibility the script offers and then you're gonna send me $10,000 on my birthday.
2007-10-02 (first published: 2002-06-20)
15,451 reads