Optional Parameters: Adam Hopes I'm Joking, But The Joke's On Me
This is absolutely my last gasp on optional parameters.
Adam Machanic left some syntax in a comment here which shows just how far off base my "last gasp" in this post was.
My syntax produced 594 logical reads to resolve a query while the equivalent dynamic SQL handled the same issue in six logical reads.
I hereby promise not to write performance analyses in public when I'm packing for vacation.
Repeat after me (although I'm apparently the only one here who needs this reinforcement): dynamic SQL is ALWAYS the one true path in an optional parameter scenario.
Thanks, Adam, for setting me straight.
So much for salvaging my dignity.. :)
-wp