Subject Re: select .. into new_table from exist_table
Author lance8086
> > > Can I use SQL-92 SELECT * INTO NEW_TABLE FROM EXIST_TABLE ???

> I thought he was asking if it was allowed to mix DDL and DML within
> one statement, and I must say I am a bit surprised if it is true
that
> the SQL-92 standard specifies this - even if it occationally would
be
> a convenient shortcut.

"select * into table from something" is perfectly acceptable ...
in MS-SQL.

I have several queries like this that I am having to replace and/or
rework the processing behind them.

As an interim measure, I modified our SQL interface layer to parse
the sql statement for "into tablename", then created and filled the
table. The app still passes "select .. into" to the interface, and
the interface takes care of the dirty work behind the scenes.

This was further complicated by the fact that most of the ms-sql
select/into's were for #temp tables, which don't exist in firebird.
That was simulated by automatically replacing #tablename
by "tablename_$(connectionid)", i.e. "bedrock_$33", in any sql
statement. ConnectionID is a unqiue number, obtained from a
generator, that the interface gets when first connecting to the
database. Daily, just drop all tables ending in "_$(digits)".

Maybe this'll give you MS-SQL immigrants some ideas for work arounds
in your situation.