Subject Re: [firebird-support] New auto-increment column, existing data
Author Alain Bastien
Use generators


Kind Regards

Alain Bastien
34 Dr Ross Avenue
Rose Hill 72102
Mauritius
Mobile Tel: +230  5 719 30 30
Skype:alainbastien
Viber: 7320143





On Tue, Nov 15, 2016 at 11:58 PM, 'Some One' anotherpersonsomewhere@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
 

I am trying to add new auto-increment primary keys for existing table.

This is what I have:
============================== ========
set term ~ ;
execute block
as
declare dbkey char(8);
begin
for
select rdb$db_key
from mytable
into :dbkey
do
begin
...
end
end~
set term ; ~
============================== ========
This fails with error "malformed string", it looks like either rdb$db_key does not match char(8) or maybe it is related to same character set settings. Any suggestions?

It also seems that when new entries are added the auto-incremented values will start from 0, causing conflicts. Is it ok to simply right click the generator in FlameRobin, select "set value" and enter a value higher than the highest existing or will that cause any trouble?