Subject Re: [firebird-support] Change a PK field from text to autonumber
Author Martijn Tonies
Hello Diego,

update mytable set id = gen_id(mygenerator, 1)

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


Hy, I need to change the PK in a table from string to numeric.
A crated a new field called "id" and I made a new generator for this
field.

I have about 2k of records in this table. I usually use a code made in
VB to fill this new field with secuential numbers, and after that,
activate the trigger to use the generator.

Because I havenĀ“t much experience in SQL programing, I need for someone
to explain me how I can use a procedure to do that with SQL code.
That is, update avery record of the field with a secuential number for
the field "id".

Thanks

Diego



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Yahoo! Groups Links