Subject SV: [firebird-support] Re: Reset genretor Value
Author Svein Erling Tysvær
Try something like

SELECT GEN_ID(TEKLIFM_TEKLIFM_Ay_GEN, -GEN_ID(TEKLIFM_TEKLIFM_Ay_GEN,0))
FROM RDB$DATABASE

That should subtract the current value of the generator from its value and the result should be 0 and, unlike SET GENERATOR, it is DML rather than DDL (theoretically, I think you risk getting a negative in the generator if two transactions fire this statement at the same time).

HTH,
Set
________________________________________
Fra: firebird-support@yahoogroups.com [firebird-support@yahoogroups.com] på vegne av ahmetdenize [ahmetdenize@...]
Sendt: 29. desember 2010 14:26
Til: firebird-support@yahoogroups.com
Emne: [firebird-support] Re: Reset genretor Value

I test it before with flame robin it is not working . My code is
if (extract(year from current_date) <> YilInt) then SET GENERATOR TEKLIFM_TEKLIFM_Ay_GEN TO 0;

error message is
if (extract(year from current_date) <> YilInt) then SET GENERATOR TEKLIFM_TEKLIFM_Ay_GEN TO 0;

--- In firebird-support@yahoogroups.com, Claudio Romero <clauslack@...> wrote:
>
> Be careful
> with
> SET GENERATOR GEN_EMAIL_ID TO 0;