Subject | Re: [IBO] What is the best way to get the next number in a indexfield |
---|---|
Author | Lucas Franzen |
Post date | 2001-06-10T10:08:49Z |
Francois Leemans schrieb:
This way you get unqiue numbers, but there are gaps between the numbers.
If you use a TIB_Query for your employee table, just make an entry in
the GeneratorLinks, like:
EMP_NO=G_EMPLOYEE
(where EMP_NO is your employeenumber and G_EMPLOYEE is your generator
(which you can set up in yxour database with: CREATE GENERATOR
G_EMPLOYEE).
What you are trying above isn't multiuser safe and can't be shown with
just a small example (you can have a look in the IBOHelp, topic: "How to
maintain a pure sequence number".)
Luc.
>Use a generator for getting the next unique number.
> I got a small table of employees, each having a unique employeenumber.
> If I want to add a new employee, what is the best way to obtain the next
> employeenumber ?
> I could search for the highest already existing number and add 1, what I
> want to know is if this is the professional way to do this.
> Any small example ?
This way you get unqiue numbers, but there are gaps between the numbers.
If you use a TIB_Query for your employee table, just make an entry in
the GeneratorLinks, like:
EMP_NO=G_EMPLOYEE
(where EMP_NO is your employeenumber and G_EMPLOYEE is your generator
(which you can set up in yxour database with: CREATE GENERATOR
G_EMPLOYEE).
What you are trying above isn't multiuser safe and can't be shown with
just a small example (you can have a look in the IBOHelp, topic: "How to
maintain a pure sequence number".)
Luc.