How do I add a column only if it doesn't exist?

2006-05-24 Thread Daevid Vincent
I want to do something like this: if not exists `hotel_page_templates`.`hpt_custom_fields` alter table `hotel_page_templates` add column `hpt_custom_fields` text after `hpt_alternate_username`; ÐÆ5ÏÐ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To

Re: How do I add a column only if it doesn't exist?

2006-05-24 Thread sheeri kritzer
I don't think MySQL can do thatmaybe with some kind of stored procedure If you're using 5.0 or higher, use the INFORMATION SCHEMA to find out if the column exists. If not, use the show create table statement and parse it. Why is this a problem, though? (just curious, I'm not sure this