Jump to content


Photo

I need a query, can't find it anywhere.


  • Please log in to reply
1 reply to this topic

#1 Natedawg

Natedawg
  • Members
  • Pip
  • Newbie
  • 2 posts
  • LocationKansas City, KS

Posted 28 December 2003 - 07:07 PM

I need a query for adding a column to my table, an auto increment one, so I can keep track of how many items I have in my database. I think it\'s like, ADD COLUMN TO Message idno int AUTO_INCREMENT is that it?
There is no spoon.

#2 jmabbate

jmabbate
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 29 December 2003 - 04:46 AM

The syntax is

ALTER TABLE table_name
ADD COLUMN column_name INT UNSIGNED NOT NULL AUTO_INCREMENT,
ADD INDEX (column_name);

You\'ll find an example in the MySQL manual, section 6.5.4 under ALTER TABLE.

Joe




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users