Home > Archive > Microsoft SQL Server forum > March 2005 > GROUP By clause or DISTINCT clause









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author GROUP By clause or DISTINCT clause
Jacek

2005-03-31, 7:01 am

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
= -1

Madhivanan

2005-03-31, 7:01 am


Which application are you using? If it is VB then it shold be client
side cursor

Madhivanan

Jacek

2005-03-31, 7:01 am

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

Erland Sommarskog

2005-03-31, 8:03 pm

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
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com