From: Peter Brawley Date: September 26 2005 5:50pm Subject: Re: add a column if not exists List-Archive: http://lists.mysql.com/mysql/189569 Message-Id: <433834DB.5060505@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Claire, >I want to check if a column exists in a table before I >do an alter table to add it. How do I do this in >mysql? Thanks. If you are using MySQL 5.0, query information_schema.columns (http://dev.mysql.com/doc/mysql/en/columns-table.html) for the table and column. Otherwise use SHOW COLUMNS FROM tablename. PB http://www.artfulsoftware.com ----- Claire Lee wrote: >I want to check if a column exists in a table before I >do an alter table to add it. How do I do this in >mysql? Thanks. > >Claire > >__________________________________________________ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com > > > -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.6/111 - Release Date: 9/23/2005