Subject | Re: [firebird-support] Add and populate a primary key |
---|---|
Author | Martijn Tonies |
Post date | 2008-06-10T08:50:57Z |
Hello Marc,
usuage.
update old_data set id = gen_id(old_data_generator, 1);
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
> I have imported data from an old database, with no primary keys inRDB$DB_KEY, but it cannot be used as a primary key in normal
> most tables. I want to add and populate a primary key to them, but I
> don't know how to do it.
>
> I remember there is some kind of virtual column to identify a row in a
> table with no primary key, but I don't remember his name and I can't
> find it.
usuage.
> How can I do something like that (what is then name of XXX field name) ? :create generator old_data_generator;
>
> -----
>
> alter table OLD_DATA add ID integer;
update old_data set id = gen_id(old_data_generator, 1);
> ----Martijn Tonies
>
> alter table OLD_DATA add constraint PK_OLD_DATA primary key (ID)
>
> ---
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com