If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Adding columns not present

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-08-04, 03:57
randdata randdata is offline
Registered User
 
Join Date: Feb 2004
Posts: 3
Angry Adding columns not present

I have created my database and Tables, but need to plan for the future before starting my programming.
Now I need to plan for Future updates, which also goes for updates on my tables. I need to add fields to CURRENT tables if they do not exist in that Table. This will all be done through code also using queries.
I have looked at the Alter table but it gives an error when a duplicate field is added.(<- This is understandable.) But I need the program to ignore fields already added. Any help or suggestions PLEEAASSSEE.
Thanks
Billy
Reply With Quote
  #2 (permalink)  
Old 04-08-04, 05:09
zeus77 zeus77 is offline
Registered User
 
Join Date: Mar 2004
Location: Venice,Italy
Posts: 20
two solution:
1) issue one alter table at time for column, and ignore errors
2) compare the structure on the db with the one you want to use, and then alter the ones that don't match...
Reply With Quote
  #3 (permalink)  
Old 04-08-04, 07:29
randdata randdata is offline
Registered User
 
Join Date: Feb 2004
Posts: 3
thanks

Just a stupid question?

How do I compare the Tables?
Reply With Quote
  #4 (permalink)  
Old 04-08-04, 11:13
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,609
Re: thanks

Quote:
Originally posted by randdata
Just a stupid question?

How do I compare the Tables?
Have your program do a SHOW TABLE, and inspect the results?

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On