Re: add a column if not exists

2005-09-27 Thread Gleb Paharenko
Hello. You can parse the output of 'SHOW CREATE TABLE' or 'SHOW COLUMNS'. See: http://dev.mysql.com/doc/mysql/en/show-columns.html http://dev.mysql.com/doc/mysql/en/show-create-table.html Claire Lee wrote: > I want to check if a column exists in a table before I > do an alter ta

Re: add a column if not exists

2005-09-26 Thread Pooly
Hi, 2005/9/26, Peter Brawley <[EMAIL PROTECTED]>: > 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. other solution, do your query in all case and check for the return error (if any). mysql> alter table

Re: add a column if not exists

2005-09-26 Thread Peter Brawley
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 COL

add a column if not exists

2005-09-26 Thread Claire Lee
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 -- MySQL Genera