notifications 61467 (11/19/2014)
Sean,Thanks for your reply.
I located a suggestion for the problem I was experiencing:
I substituted a local variable for the stored procedure parameter used in multiple where clauses.
The SP now completes in 5 seconds.
This means you were experiencing bad parameter sniffing.
If you want to read further and understand this issue further the following set of 3 articles is a must read on this topic.
http://sqlinthewild.co.za/index.php/2007/11/27/parameter-sniffing/
[/url]
http://sqlinthewild.co.za/index.php/2008/02/25/parameter-sniffing-pt-2/[/url]
http://sqlinthewild.co.za/index.php/2008/05/22/parameter-sniffing-pt-3/[/url]
Glad you were able to resolve your issue.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/