I looked at the SHOW COLUMNS statement and they have what I want, but I need to condition off them. For example, I don't want to execute an ALTER TABLE command to add a column if that column is already there. I've tried IF DOES NOT EXIST SHOW COLUMN ... followed by the ALTER TABLE command, but the if check doesn't seem to work on SHOW COLUMNS.
Am I missing something, or is this just something that is not supported? Thanks Shishir Ghate -----Original Message----- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: Monday, July 26, 2004 2:21 PM To: Ghate, Shishir; [EMAIL PROTECTED] Subject: Re: SQL for detecting if Column/Index already exists? At 14:08 -0500 7/26/04, Ghate, Shishir wrote: >Hello, > >I am trying to write a db creation script that will create a >database as a well as repair an existing database. What I can't >seem to find is a set of key words that will allow me to detect if a >column or index already exists in a table and thus skip the creation >of the column or index. I've found the proper syntax to check for >table existance, but I can't find the syntax for column/index >existance. > >If someone could point me to a set of docs or an example SQL >command, that would be great. You could use the SHOW COLUMNS and SHOW INDEX statements? -- Paul DuBois, MySQL Documentation Team Madison, Wisconsin, USA MySQL AB, www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]