Re: Loading database from script files
Posted in 1994
>From: sinues@prcd.prc.mrms.navy.mil (John Sinues)
>Subject: Loading database from script files
>Date: 10 Aug 1994 09:42:32 -0500
>X-Informix-List-Id: <news.8098>
>I have an ASCII file containing a number of INSERT-INTO statements. I
>want to execute this file and load an Informix OnLine database. Two questions:
> 1. How can I load this script from the command line? Can I
> do something like this:
>
> isql -ansi {dbname} < {SQL_script.sql file}
Either: isql dbname - < script.sql
Or: isql dbname script.sql
You can use any name you like with I/O redirection. Your file name must
end .sql to be used as an argument, though you don't have to specify the
.sql suffix on the command line. Also works with dbaccess.
> 2. How should my SQL_script.sql file end? I have a "COMMIT WORK"
> statement at the end -- do I need anything else? ...
Just the COMMIT; Informix will stop when it reaches the end of file.
If you omit the commit, you effectively place a rollback there.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>