Reputation: 8419
extra
field of information_schema.columns
and have its name, then it would easy to drop that column from a specific table. But i am seeking for a better solution.Question (If it is not already clear :)
Is there any query/function to drop all auto-increment columns from database? or at least is there a way to drop an auto-increment column from specific table without knowing the name of that column?
I am thinking this because there can be only 0 or 1 auto-increment column in a table, so mysql might have some built-in extended function to deal with that type of field
Upvotes: 0
Views: 229
Reputation: 781004
While there's no built-in mechanism to do this, you could write a script that reads information_schema
and generates all the necessary alter table
commands.
Upvotes: 0
Reputation: 18358
There is no such builtin function. Your point #3 is a good option to do this in MySQL. you can also parse desc mytable
output.
Upvotes: 1