Hi Keith,
Let's first eliminate posibilty that bad execution plan cached by SQL server is responsible. You can force SQL Sewrver to recompile sproc every time by adding 'WITH RECOMPILE' to the CREATE/ALTER PROCEDURE. Alternativelly, you can issue DBCC FREEPROCCACHE before running sproc to clear cached plans.
>I've come across a weird situation. I have a stored procedure (code below), and it's fairly simple. I frequently "unroll" stored procedures to work on the execution plan. So I unrolled this one and found a huge discrepancy in the execution times between the SP and the straight select.
>
>The SP executes in 1:14 and the straight SQL executes in :12!
>
>Maybe I need another pair of eyeballs. Can you see any difference between the two?
>
<snip>
--sb--