Subject | Re: How to update table structure with SQL? |
---|---|
Author | neighbour.kerry |
Post date | 2009-06-23T02:58:53Z |
--- In firebird-support@yahoogroups.com, Flávio Costa <fcosta75@...> wrote:
All I really need to do is add new columns to existing tables, or create any new tables.
I have Indexes, Triggers, Generators and Procedures worked out. I simply DROP them all - then recreate them all with my script. Since this does not affect customer data, it works just fine.
But this does not work for tables and columns. There does not seem to be any way to check if a table or column exists.
I am currently doing all this stuff in Delphi. ie, I read in the metadata (using Delphi), then check, using Delphi, if a table exists. If it does, I feed out the ALTER script - if it does not, I feed out the CREATE script. It works, but it is a very poor way to do it!
I now need to do the same with columns, and I can do it the same way in Delphi, but I would rather do everything with a Firebird SQL statement. Much more portable, and probably quicker.
>Isn't that for syncing data? If that is so, then I certainly do NOT want to do that. I cannot touch the existing data in the customer tables.
> You could use a component set to sync databases.
>
All I really need to do is add new columns to existing tables, or create any new tables.
I have Indexes, Triggers, Generators and Procedures worked out. I simply DROP them all - then recreate them all with my script. Since this does not affect customer data, it works just fine.
But this does not work for tables and columns. There does not seem to be any way to check if a table or column exists.
I am currently doing all this stuff in Delphi. ie, I read in the metadata (using Delphi), then check, using Delphi, if a table exists. If it does, I feed out the ALTER script - if it does not, I feed out the CREATE script. It works, but it is a very poor way to do it!
I now need to do the same with columns, and I can do it the same way in Delphi, but I would rather do everything with a Firebird SQL statement. Much more portable, and probably quicker.