Ray K (8/23/2013)
I default them both to null in the stored proc. In my code, I set them to 1/1/1900 and getdate(), respectively.
And that's your problem right there.
http://sqlinthewild.co.za/index.php/2008/05/22/parameter-sniffing-pt-3/
If you're going to change the values of parameters, you need to use variables instead. Otherwise the plan is compiled for parameter values of NULL and when it runs with something non-null you have a really, really inappropriate execution plan
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability