At 10:37 AM 11/19/2002 -0500, Steve Johnson wrote:

I am sure there is a better way to control autonumber more
effectively.  And I want to minimize the additional keystrokes
needed on a repetitive basis to prevent instances of an
unwanted incremented autonumber column. Suggestions?

Steve,

Ask and you shall receive. No worries, mate!

Using The Glorious R:BASE 2000 (ver 6.5++), In-Line Patch-3, Build:1.854xRT03
and higher, you can take advantage of the NEW feature of "AFTER TRIGGERS"
to update the column after the actual INSERT has occurred. Then, use the simple
scenario as following:

SET VAR vMaxNo INTEGER = 0

SELECT (MAX(ColumnName)+1) INTO vMaxNo INDIC IvMaxNo FROM TableName

UPDATE TableName SET ColumnName = .vMaxNo WHERE COUNT = INSERT

Background:

The current triggers are All "BEFORE" triggers in that they run just
before the actual INSERT, UPDATE, or DELETE and give you the ability
to abort the action. The new triggers are "AFTER" triggers in that
they run just after the action.

The new triggers can be created by the create table command or by
the alter table command. When you use the alter table command you
must define the insert triggers in the same command. The same goes
for update and delete. Do not use one alter table command to add
the "BEFORE" insert trigger and then another alter table to add the
"AFTER" trigger. Do them both in the same command. When you drop a
trigger, you do not specify the "BEFORE" or "AFTER" trigger. The
drop of the insert trigger, for example, drops both parts of they
are there.

LIST TRIGGERS and UNLOAD command has also been updated to include
these changes.

Should you need further assistance or step-by-step instructions, feel
free to contact me privately at mailto:[EMAIL PROTECTED]

If you would like to test the latest and greatest in-line patch-3 beta,
send your request to: mailto:[EMAIL PROTECTED]

Enjoy the benefits of staying CURRENT!

Very Best Regards,

Razzak.



================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/


Reply via email to