This behavior is typically caused by the fact that the FIRST time you run a
SP the query plan is constructed based on the input parameter values
provided. Each subsequent invocation uses this cached query plan--even if it
does not make sense based on the passed parameter values. As I discuss in
the book, the trick here is to construct the SP so the parameters do NOT
impact the query plan.
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
[quoted text, click to view] "guy" <guy@discussions.microsoft.com> wrote in message
news:908BD5EF-DE7F-4826-AF20-EABECA34E691@microsoft.com...
> c#2008 / sql server 2005
>
> I have a stored proc that takes 2 parameters
> if run it through management studio
> either with pramaeters x,y or a,b it correctly returns the same set of
> data
> (about 100 rows) in about 1 (one) second
>
> if i run it through my c# test harness (using a dataadapter fill)
> with parameters x,y again i get the correct set of data in about 1 second
> however if i run it with parameters a,b it times out (timeout is set to 30
> seconds)
>
> any idea how i can track this one down?
>
> Guy
>