BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

delphi mysql If not exist column

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Eric
Guest





PostPosted: Thu Apr 22, 2004 4:02 pm    Post subject: delphi mysql If not exist column Reply with quote



Hi I'm usign Delphi6 with MySQL ODBC.. I want to update a table if the
column doesn't exist.. So I need to validate if the column exist and if not
create it...
I can do this/..
ALTER TABLE INVOICING
ADD COLUMN USERINT INT

But every time i want to pus the IF NOT EXIST code I got an error...

Someone has an example?

Thank you


Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Thu Apr 22, 2004 10:18 pm    Post subject: Re: delphi mysql If not exist column Reply with quote



Eric wrote:
Quote:
Hi I'm usign Delphi6 with MySQL ODBC.. I want to update a table if the
column doesn't exist.. So I need to validate if the column exist and
if not create it...
I can do this/..
ALTER TABLE INVOICING
ADD COLUMN USERINT INT

You could query the system tables, however it's probably just as easy to
just execute your Alter statement above - if the column already exists, the
statement will simply return you an exception, it won't cause any problem in
the database.


--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"True peace is not the absence of tension, but the presence of
justice." - Martin Luther King, Jr.



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.