DelphiFAQ Home Search:

Modifying a field to be auto_increment

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Question:

I need to modify my primary key to be an auto_increment field.

Answer:

For some reason

Table name: T1, primary key field name: F1

alter table T1 change F1 F1 integer not null auto_increment;

will work, but

alter table T1 change F1 F1 integer not null auto_increment primary key;

does not work. However, after statement #1 the field F1 will still be the primary key. This was observed in mysql 4.0


Content-type: text/html

Comments:

2010-01-23, 07:49:00
anonymous from India  
thanks dear its very use full for me Surender Pal Pareek (Jaipur) -ROR

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: