Board index » delphi » GenID() in Select Statement

GenID() in Select Statement


2006-02-27 11:19:42 PM
delphi265
Hi,
I need a "Line Counter" in many different SQL-Queries. So I created a
Generator "LINECOUNTER", which I set to zero before I execute the Query.
My Select - Statement is as follows : Select GEN_ID(LINECOUNTER,1), NAME
from ADDRESS
I works with an simple Statement, but when I add Joins or Orders, the first
Linecounter-Value ist always a Multiple of the RecCount.
Any suggestions how I can avoid this?
Thanks
Kai
 
 

Re:GenID() in Select Statement

Kai E. Osterhoff writes:
Quote
I need a "Line Counter" in many different SQL-Queries. So I created a
Generator "LINECOUNTER", which I set to zero before I execute the Query.
My Select - Statement is as follows : Select GEN_ID(LINECOUNTER,1), NAME
from ADDRESS
I works with an simple Statement, but when I add Joins or Orders, the first
Linecounter-Value ist always a Multiple of the RecCount.
Any suggestions how I can avoid this?
This may produce interesting result in a multi user situation...
Maybe a "selectable" StoredProdecure will be an acceptable solution.
--
Aage J.
 

Re:GenID() in Select Statement

Aage Johansen writes:
Quote
Maybe a "selectable" StoredProdecure will be an acceptable solution.
I agree this would be a better solution.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
Please read and follow Borland's rules for the user of their
server: support.borland.com/entry.jspa