Sunday, February 26, 2012

GROUP By clause or DISTINCT clause

Hi, can anyone shed some light on this issue?

SELECT Status from lupStatus
with a normal query it returns the correct recordcount

SELECT Status from lupStatus GROUP BY Status
but with a GROUP By clause or DISTINCT clause it return the recordcount
= -1Which application are you using? If it is VB then it shold be client
side cursor

Madhivanan|||Madhivanan, thanks for your response, we are not using client side
cursor, but server side (the query work fine, adLockReadonly but it
doesn't work when we use adLockOptimistic) VB COM|||Jacek (jack.pedzikiewicz@.gmail.com) writes:
> Madhivanan, thanks for your response, we are not using client side
> cursor, but server side (the query work fine, adLockReadonly but it
> doesn't work when we use adLockOptimistic) VB COM

So the count we are talking about is Recordset.RecordCount?

What cursor type do you ask for? A query with GROUP BY or DISTINCT
can only result in a static or forward-only cursor, and it cannot
be updatable. A static cursor has a rowcount, a forward-only cursor
has not.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

No comments:

Post a Comment