Suppose you have an input file called QUERY1 that contained the following:
SELECT REGION_CODE, CUSTOMER.NAME,
PAYMENT_VALUE
FROM REGION, CUSTOMER, ORDER_HEADER
WHERE PAYMENT_VALUE > 1000
AND ORDER_HEADER.CUSTOMER_NUMBER = CUSTOMER.CUSTOMER_NUMBER
AND CUSTOMER.REGION_CODE = REGION.REGION_CODE
ORDER BY REGION_CODE ASC, PAYMENT_VALUE DESC;
You could use this command line:
SQLEXE <query1 >result1 -DB salesord
to run the SQL statement held in QUERY1 against the SALESORD database and to send any data which resulted to RESULT1. (The database must be specified with the '-db' command tail). In some situations you may not be able to rely on a command line to redirect SQLEXE's input and output like this. In this case you could use this command line instead:SQLEXE -read query1 -write result1
The numerous SQLEXE command tails are described here.
The results should appear in the file RESULT1 as shown below:
Region_Code Name Payment_Value |