Go to the first, previous, next, last section, table of contents.


Declaring SQL Input Files

You declare a file as an SQL query using the predefined macro DATABASE. The name of the file must have a .sql extension. This is shown in the example below which loads two files as SQL queries.

%%DATABASE	"cat.sql" "dog.sql"

In the above the cat.sql file and dog.sql files are treated as SQL queries (they do not need to exist as files). In the former this would be select * from cat and in the latter this would be select * from dog. The names of the database files for reference in equates would be cat and dog. In this example cat would be the master database file since it was loaded first.

It is possible to use any SQL select statement if the default is not suitable since the DATABASE predefined macro allows a text body extension to define the SQL select statement for this type only. The example below shows how this would be done.

%%DATABASE  "cat.sql"
%%DATABASE  "dog.sql"
select name, type from dog order by name

In the above the cat.sql file is interpreted as in the previous example but the dog.sql file has a customised SQL select statement defining what that database file should contain. The SQL select statement can be of any complexity up to the ordinary size limits of a text body, but there can be only one (unless formed from a union) and no other SQL statement can be used.


Go to the first, previous, next, last section, table of contents.