I have a query that's timing out when used by one of our application users, but it doesn't we I test it against our database, I checked indexes and execution plan of the query on both databases and are the same. when i run a profiler i see that it's using sp_cursoropen, does anybody know the SP is doing and why?
declare @P1 int
set @P1=180150000
declare @P2 int
set @P2=8
declare @P3 int
set @P3=1
declare @P4 int
set @P4=1
exec sp_cursoropen @P1 output, N'SELECT count(*) FROM doc2 (NOLOCK) INNER JOIN doc2_address (NOLOCK) on doc2.doc2_id = doc2_address.doc2_id INNER JOIN address (NOLOCK) ON doc2_address.address_id = address.address_id WHERE ( doc2.status_cd = ''BAD'' OR doc2.status_cd = ''REL'' OR doc2.status_cd = ''REJ'' OR doc2.status_cd = ''FNG'') AND doc2.processDate BETWEEN ''01/01/1997 17:30'' AND ''01/23/2004 17:30'' AND ( address.address_text like ''%yahoo.com AND doc2_address.address_type_cd = ''FRM'' ) ', @P2 output, @P3 output, @P4 output
select @P1, @P2, @P3, @P4