Subject | Re: Hundreds of Generators |
---|---|
Author | zvjezdantomicevic |
Post date | 2010-04-29T08:37:43Z |
Just from top of my head:
How about creating table
ITEM_ID int
YEAR int
COUNTER int
and use triggers.
If record for that year does not exist,insert it with counter 0,
and if it does, increase counter by 1 using trigger.
You have if exists, insert or update statements, and before insert/update triggers at your disposal to do this.
How about creating table
ITEM_ID int
YEAR int
COUNTER int
and use triggers.
If record for that year does not exist,insert it with counter 0,
and if it does, increase counter by 1 using trigger.
You have if exists, insert or update statements, and before insert/update triggers at your disposal to do this.
--- In firebird-support@yahoogroups.com, "venussoftop" <venussoftop@...> wrote:
>
> It think it is necessary, from my POV, please correct me if I am thinking wrong. The numbers are for batch no. of pharmacy products and numbering is restarted every financial year and because they are used on consumer readable labels I need them as integers. The generated numbers look like this finally ITM001-505-09/10 where ITM001 is the product code, 505 the generator number and 09/10 the financial year.
>
> Thanks and regards
> Bhavbhuti
>
> --- In firebird-support@yahoogroups.com, "zvjezdantomicevic" <zvjezdantomicevic@> wrote:
> >
> > Well, this usage of generators is a bit uncommon, and may not be a sound design.
> > Philippe suggested that you use globaly unique identifiers (GUID) instead of integers.
> > They sound like good solution in this case, unless it is absolutely essential to use integers and restart them every year.
> >
> > --- In firebird-support@yahoogroups.com, Bhavbhuti Nathwani <venussoftop@> wrote:
> > >
> > > Thanks Philippe, but I am sorry I did not understand what you mean to say I
> > > do.
> > >
> > > Kind regards
> > > Bhavbhuti
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
>