Subject | Re: [firebird-support] Firebird record number |
---|---|
Author | Martijn Tonies |
Post date | 2006-11-27T12:37:04Z |
Hello Julien,
alter table <your table>
add column with not null and so on.
Next, create a "generator":
create generator g_mytable;
update yourtable
set newcolumn = gen_id(g_mytable, 1);
And you're done with.
Next, create your primary key on that column.
Martijn Tonies
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 want to add a field in a table that contains the record number of theWell, there are no rownumbers, but you can easily do this.
> line.
> this field will be the key field because my data are so bad without
> unique key.
> so the idea is to create a field then update the field with rownumber
> for each row.
alter table <your table>
add column with not null and so on.
Next, create a "generator":
create generator g_mytable;
update yourtable
set newcolumn = gen_id(g_mytable, 1);
And you're done with.
Next, create your primary key on that column.
Martijn Tonies
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