Huh? What is TQL? A new query language...Tequila Query Language perhaps?
Nope. A SQL Server Template. When I'm not stealing code, I'll use a template to get sprocs going. For the most part, Error Handling in a sproc is the same (well for me) 99% of the time.
Just cut and paste the code in to a *.tql file in the folder:
C:\Program Files\Microsoft SQL Server\80\Tools\Templates\SQL Query Analyzer\Create Procedure
Then in QA Do [CTRL]+[SHIFT]+{INSERT] to insert a new template. To update the values in the template (for example the new name of your sproc, [CTRL]+[SHIFT]+M. A dialog will appear and you can change the...
Always seem to asked...bugged the hell out of me..The answer always seemd to be dynamic SQL since anything in the predicate to handle the absence of a criteria would cause a scan of the index...stage 2 predicate (non sargable) and all..
But what about this? Just add as many Left Joins as you need.....if properly indexed, it all index seek on the main/large table that's being searched.
All Comments appreciated
EDIT: After more research, I don't think ( I hate when that happens) That you can have a full AND Condition, but all we can hope for is a ranking of how many not...