Re: Including an SQL file into an SQL file
Posted in 1998
In article <362760F9.6DFF@NA.COM>, NA@NA.COM (Paul Jeremy) wrote:
> Hi,
> I'm trying to find out if there is a way to embed an sql script into
> another sql script. Basically what I'm trying to do with a script is to
> rename 75 tables, and rebuild each one with it's dbschema.
>
> e.g. We have two tables, table1 and table2. table1 and two are the same
> format but table1 has older data.
>
> use dbschema on table2 to get structure
> *remove table1
> *remove indexes table2
> *rename table2 to table1
> *build indexes table1
> *and then use the schema to rebuild a clean table2.
>
> What I'd like to do is merge the lines I have with * together. The first
> 4 are easy but how to I get the dbschema sql file included in the same
> script.
>
> Thanks,
>
> Paul
>
> If you don't understand what I'm on about - give up! Cos most of the
> time I don't know what I'm writing.
>
I think what you mean is
dbschema table2 table2.sql
echo "*remove table1" >sqlfile
echo "*remove indexes table2" >>sqlfile
echo "rename table2 to table1" >>sqlfile
echo "*build indexes table1" >>sqlfile
cat table2.sql >> sqlfile
dbaccess sqlfile
Paul Watson # I don't suffer from
WF Software Ltd. # stress, I'm just
Tel. (+44) 1436 674729 # a carrier
Fax. (+44) 1436 678693 #
www.wfsoftware.co.uk