Subject Re: [firebird-support] Re: Key violation on Primary/Unique key constraint INTEG_55/30 on table(s)
Author Gaurav Sood
You have killed two birds with one stone with this post!

The problem with the INTEG_55 constraint has also been solved using
this method, by setting the TRANSCRIPTIONIDGEN value to the max value
of the database.

One question:

How do I decrement the value of the Generator (without setting it) if
I have tried to make a new person, but decided to cancel the idea.
Therefore, when I press the 'Cancel' button on a form, it will
decrement the Generator value?

Thanks heaps!

Gaurav





On 3/14/06, Svein Erling Tysvær <svein.erling.tysvaer@...> wrote:
> --- In firebird-support@yahoogroups.com, "Gaurav Sood" wrote:
> > Good insight Svein!
> >
> > That's one problem that I didn't know about and is infact the
> > probable cause (most likely) as the first query produced a result of
> > 103, where as the Max value for ID is 140.
> >
> > What do I do to set the Generator to the correct values here ?
> > SET GENERATOR PEOPLEIDGEN TO 140 ?
>
> Yes.
>
> > How do I automate it for the rest of the tables which have
> > generators controlling the insertion of values ?
> >
> > Thanks!
>
> Automate? Well, I guess it should be possible, though it does require
> some research. You have to query system table(s) to find the
> generators and look for dependencies to find which generator is
> affiliated with which table. Though if you generally use
> <tablename>+'IDGEN' as the name of your generators it may be a bit
> simpler. http://www.fbtalk.net/viewforum.php?id=13 does contain some
> interesting queries that may help you get started.
>
> Myself, I'm pretty lazy and guess I would just have added another
> table to my database, a table which simply contains generator, table
> and column name. Then it should be very easy to write a small program
> that does this checking for you based on the values in the table.
>
> HTH,
> Set
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>


--



Analyst
B. Engineering, B. IT
A.N.U (2004)

M: +61 401 409 620
H: +61 3 9376 8580


"In life, always do right. This will gratify some people and astonish the rest."

— Mark Twain