Operating System - HP-UX
1751710 Members
4950 Online
108781 Solutions
New Discussion юеВ

Re: MySQL in HP-UX, how to populate an INT Field with ROWNUM/RECORDID Values?

 
SOLVED
Go to solution
Alzhy
Honored Contributor

MySQL in HP-UX, how to populate an INT Field with ROWNUM/RECORDID Values?

I added a INT column named KNBO to an existing populated TABLE. I want to set the value/contents of the filed KBNO to be the record number or rowid.

How do I?


Many thanks!
Hakuna Matata.
2 REPLIES 2
Laurent Laperrousaz
Regular Advisor
Solution

Re: MySQL in HP-UX, how to populate an INT Field with ROWNUM/RECORDID Values?

to add a field as a rownum, it just has to be auto_increment in the definition. So change your field definition

ALTER TABLE `TABLE` CHANGE `KNBO ` INT NOT NULL AUTO_INCREMENT PRIMARY KEY

That's it!

The field has to be the primary key

Hope this helps!
Jean-Luc Oudart
Honored Contributor

Re: MySQL in HP-UX, how to populate an INT Field with ROWNUM/RECORDID Values?

Nelson,

see example at :
http://dev.mysql.com/doc/mysql/en/example-auto-increment.html

Regards
Jean-Luc
fiat lux