× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



As Birgitta said, a before insert is what you want.

I do have to ask though. Why not use an identity column and have the
system autoincrement it for you?

Create table...
myKeyColumn int as identity,
...

Or perhaps a sequence object? Below is a tested example of sequence
created with "Run SQL Scripts":

set current schema rob;

create or replace sequence NextKey;

create table scuzz (
myKeyColumn int as identity,
SomeOtherColumn char(5),
CounterNumber int);

insert into scuzz
(SomeOtherColumn, CounterNumber)
values ('A', next value for NextKey);

insert into scuzz
(SomeOtherColumn, CounterNumber)
values ('B', next value for NextKey);

select * from scuzz;
you will see:
1, A, 1
2, B, 2

values previous value for NextKey;
You will see: 2

If you want to know what object it creates try DSPDTAARA. It's rather
complex though.
Data area . . . . . . . : NEXTKEY
Library . . . . . . . : ROB
Type . . . . . . . . . : *CHAR
Length . . . . . . . . : 2000
I think it uses all that space to keep track of last accessed information.

Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.