Subject Re: [firebird-support] Renaming a table
Author Martijn Tonies
Hi,

> >>>What is the SQL statment to rename a table in firebird please.
> >>>
> >>>
> >>
> >>There isn't.
> >>
> >>CREATE NEWTABLE
> >>COPY DATE FROM OLD TABLE
> >>DROP OLDTABLE
> >>
> >>Any links to the old table will be flagged when it is dropped, but
> >>simply trying to change the name causes problems with triggers and
> >>foreign keys linked to the table, hence the three step process is a lot
> >>safer. Data is protected at all times.
> >>
> >>Major structural changes - I create the new database, check it out, and
> >>then pump the data from the working copy. Any problems can be addressed
> >>before making the new copy live, and the old copy is still available
> >>until that time!
> >>
> >>
> > It would be nice if this were possible. Having to rename a table does
> > happen...
>
> It is not part of the SQL standard, yet. It has been suggested to add
> to the standard the statement RENAME TABLE, but it is just a
> suggestion as of now and not part of SQL-2003(only mentioned in 2
> lines of text). Although, MS-SQL doesn't support it, Oracle does.
> So, my guess is that it is Oracle that submitted the RENAME TABLE
> syntax to be included in the standard.
>
> I would support the feature myself, but it would have to be something
> that is performed with an exclusive connection. And, the
> implementation would have to be well thought out, since there can
> (more likely will) be dependencies on the table being renamed.

Indeed. FKs and so on will be "easy", but not triggers/procedures...

Guess it's time for my "invalid objects" push again ;-)

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com