Page 1 of 1

[SOLVED] How to insert new field and populate it with data?

Posted: Thu Mar 04, 2004 6:53 pm
by shucash
hey guys,

I'm sure this will be a no brainer for people in this forum.

I have a small database of products. I want to add a field, called product_id, to the database, so that every product now has an incremental product_id.

The original designer did not add this field when he created the database, and removing products is VERY ugly right now.

Any ideas?
Vin

Posted: Thu Mar 04, 2004 7:25 pm
by Illusionist
read over this

Posted: Thu Mar 04, 2004 10:18 pm
by shucash
Perfect! Thank you.

For anyone reading this post who was curious, here is what worked:


ALTER TABLE t2 ADD product_id INT UNSIGNED NOT NULL AUTO_INCREMENT, ADD INDEX (product_id);

Vin

Posted: Thu Mar 04, 2004 11:33 pm
by infolock
**** moved to databases ****