erenpasa
asked on
Add Column To Mysql Table
Hi to all,
I want to check field if not exists so add a field to table.
But i want to it just PURE SQL... with not php or etc...
is there any way?
I want to check field if not exists so add a field to table.
But i want to it just PURE SQL... with not php or etc...
is there any way?
/*
i want to add myfield if it's not exists. just PURE SQL pls..
*/
ALTER TABLE mytable
ADD myfield varchar(20)
Just add it anyway. If the field exists, it will return an error. If it doesn't exist, it will add it. If this is part of some longer script, run it with mysql --force < file.sql
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.