Subject Re: [firebird-support] New auto-increment column, existing data
Author
---In firebird-support@yahoogroups.com, <anotherpersonsomewhere@...> wrote :

As said I was a little unclear in my first post, my problem is not to create the autoincrementing field which most of your replies is about but to handle existing table entries. (Neither will I use the rdb$db_key for something persistent.)
However the "character set octets" solved my problem and I also found out how to update the generator value regarding the existing items. Here is my working version:
 
set term ~ ;
execute block
as
 declare dbkey char(8) character set octets;
begin
 for
 select rdb$db_key
 from mytable
 into :dbkey
 do
 begin
  update mytable set id = next value for mygenerator
  where rdb$db_key = :dbkey;
 end
end~
set term ; ~

  This is full (and less efficient) equivalent of the

    update mytable set id = next value for mygenerator

Regards,
Vlad