autoincrement integer-field

maxpade

New Member
hi all,

does anyone know how can i increment an integer field (as primary-key) like in MySql(autoincrement)?
is there an example somewhere in the web or can someone post me an example????:rolleyes:
thanks:)
maxo

e.g. incrementing every time i save a record to the db-table
1
2
3
,,,,
 
database sequences were designed for that purpose

from the programming handbook

<quote>

Chapter 16, “Updating Your Database and Writing Triggers,” you saw how you can use
database sequences to generate a sequence of unique integer values, for example, as key values
for a database field such as a Customer Number or Order Number. Sequences are much faster
than using an integer field in a control record stored in the database, and they do not cause lock
conflicts as a control record does. To obtain unique values from a field in a database record, each
user needs to get an EXCLUSIVE-LOCK on the record within a transaction, retrieve its value,
increment the value, and then end the transaction and release the record. This is very time
consuming, especially when you consider that it is likely that many users will be trying to do
this at the same time. This is exactly the purpose that database sequences were designed for.
When you execute the NEXT-VALUE function on a sequence, the OpenEdge RDBMS increments
the sequence and returns the value to you in a single operation, so that there is no chance that
another user can see the same value, but without any need for a transaction.

</quote>

theres also a strait forward exampe in the doc, and the 4gl reference doc. hth



you can download the docs @psdn, if you dont already have a copy

http://www.progress.com/progress_so...entation/openedge10_1a/docs/openedge_101a.zip
 
it works now.
my error was, that ive put the trigger into the tables field not in the table itself
thanks
 
Back
Top