ExecuteReader Help

  • Thread starter Thread starter Jose Ines Cantu Arrambide
  • Start date Start date
J

Jose Ines Cantu Arrambide

Hello,
When I do a SqlReader oReader = oCommand.ExecuteReader() the code
jumps to the next line until all the result set is retrieved, and for a
particualar view I have it takes about 40 seconds to do this.
*If I do a "Return all Rows" on the view on the SqlServer Enterprise
Management it starts giving rows in less than 2 seconds.
Is there another way to execute the reader that it waits on
oReader.Read() instead on ExecuteReader() or anything similar that would
start giving rows faster like in the Enterprise Management?

Thanks is advance.
Jose.
 
Hi Jose,

Try the same select within Query Analyzer to see how long does it take.
 
It takes the same as if I do a ExecuteReader()... about 40 seconds
what is the difference between SqlEnterprise "Return All Rows" &
SqlAnalyzer?

Miha Markic said:
Hi Jose,

Try the same select within Query Analyzer to see how long does it take.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Jose Ines Cantu Arrambide said:
Hello,
When I do a SqlReader oReader = oCommand.ExecuteReader() the code
jumps to the next line until all the result set is retrieved, and for a
particualar view I have it takes about 40 seconds to do this.
*If I do a "Return all Rows" on the view on the SqlServer Enterprise
Management it starts giving rows in less than 2 seconds.
Is there another way to execute the reader that it waits on
oReader.Read() instead on ExecuteReader() or anything similar that would
start giving rows faster like in the Enterprise Management?

Thanks is advance.
Jose.
 
Hi Jose,

What is the select?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Jose Ines Cantu Arrambide said:
It takes the same as if I do a ExecuteReader()... about 40 seconds
what is the difference between SqlEnterprise "Return All Rows" &
SqlAnalyzer?

Miha Markic said:
Hi Jose,

Try the same select within Query Analyzer to see how long does it take.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Jose Ines Cantu Arrambide said:
Hello,
When I do a SqlReader oReader = oCommand.ExecuteReader() the code
jumps to the next line until all the result set is retrieved, and for a
particualar view I have it takes about 40 seconds to do this.
*If I do a "Return all Rows" on the view on the SqlServer Enterprise
Management it starts giving rows in less than 2 seconds.
Is there another way to execute the reader that it waits on
oReader.Read() instead on ExecuteReader() or anything similar that would
start giving rows faster like in the Enterprise Management?

Thanks is advance.
Jose.
 
Thanks, here is the select statement. It gets me ranges of missing integers.

SELECT t1.Clave_Documento, t1.Consecutivo_Documento + 1 AS Desde,
MIN(t2.Consecutivo_Documento) - 1 AS Hasta
FROM dbo.Transacciones t1 INNER JOIN
dbo.Transacciones t2 ON t1.Consecutivo_Documento <
t2.Consecutivo_Documento AND t1.Clave_Documento = t2.Clave_Documento AND
t1.SubSeccion = 4 AND t2.SubSeccion = 4 AND
t1.Balance_Inicial = 0 AND t2.Balance_Inicial = 0
GROUP BY t1.Clave_Documento, t1.Consecutivo_Documento
HAVING (t1.Consecutivo_Documento < MIN(t2.Consecutivo_Documento) - 1)






Miha Markic said:
Hi Jose,

What is the select?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Jose Ines Cantu Arrambide said:
It takes the same as if I do a ExecuteReader()... about 40 seconds
what is the difference between SqlEnterprise "Return All Rows" &
SqlAnalyzer?

Miha Markic said:
Hi Jose,

Try the same select within Query Analyzer to see how long does it take.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Hello,
When I do a SqlReader oReader = oCommand.ExecuteReader() the code
jumps to the next line until all the result set is retrieved, and
for
 
Hi Jose,

How do you run such a select in Enterprise manager?
Is it a stored procedure?

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Jose Ines Cantu Arrambide said:
Thanks, here is the select statement. It gets me ranges of missing integers.

SELECT t1.Clave_Documento, t1.Consecutivo_Documento + 1 AS Desde,
MIN(t2.Consecutivo_Documento) - 1 AS Hasta
FROM dbo.Transacciones t1 INNER JOIN
dbo.Transacciones t2 ON t1.Consecutivo_Documento <
t2.Consecutivo_Documento AND t1.Clave_Documento = t2.Clave_Documento AND
t1.SubSeccion = 4 AND t2.SubSeccion = 4 AND
t1.Balance_Inicial = 0 AND t2.Balance_Inicial = 0
GROUP BY t1.Clave_Documento, t1.Consecutivo_Documento
HAVING (t1.Consecutivo_Documento < MIN(t2.Consecutivo_Documento) - 1)






Miha Markic said:
Hi Jose,

What is the select?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Jose Ines Cantu Arrambide said:
It takes the same as if I do a ExecuteReader()... about 40 seconds
what is the difference between SqlEnterprise "Return All Rows" &
SqlAnalyzer?

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi Jose,

Try the same select within Query Analyzer to see how long does it take.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Hello,
When I do a SqlReader oReader = oCommand.ExecuteReader() the
code
jumps to the next line until all the result set is retrieved, and
for
a
particualar view I have it takes about 40 seconds to do this.
*If I do a "Return all Rows" on the view on the SqlServer Enterprise
Management it starts giving rows in less than 2 seconds.
Is there another way to execute the reader that it waits on
oReader.Read() instead on ExecuteReader() or anything similar that would
start giving rows faster like in the Enterprise Management?

Thanks is advance.
Jose.
 
Back
Top