kokjoh
asked on
usage of isql.exe form a batchfile
Hi,
I 'm using isql -page 5000 -i Controler.SQL
to run some questions in a batchfile
But now i still have to add the outputfile in the controler.sql
egg.
CONNECT "database.gdb" USER "user" PASSWORD "pass";
OUTPUT ABCDE.txt;
Select * from table where field like "ABCDE"
Can I use somekind of parameter to set the outputfile?
Can I use a parameter within the select statement to run more selections to a set of txt-files. with several inputs instead of ABCDE
thanks,
kokjoh
I 'm using isql -page 5000 -i Controler.SQL
to run some questions in a batchfile
But now i still have to add the outputfile in the controler.sql
egg.
CONNECT "database.gdb" USER "user" PASSWORD "pass";
OUTPUT ABCDE.txt;
Select * from table where field like "ABCDE"
Can I use somekind of parameter to set the outputfile?
Can I use a parameter within the select statement to run more selections to a set of txt-files. with several inputs instead of ABCDE
thanks,
kokjoh
ad. 1
try
isql -page 5000 -i Controler.SQL -o ABCDE.txt
:-)
ad. 2
If I've been unterstand, you can't
coz OUTPUT file is solely future of isql.exe and have nothing to do with SQL
Brcko
try
isql -page 5000 -i Controler.SQL -o ABCDE.txt
:-)
ad. 2
If I've been unterstand, you can't
coz OUTPUT file is solely future of isql.exe and have nothing to do with SQL
Brcko
Here's what I was able to do:
Create an SQL file to run the desired queries:
( I called this one test_output.sql )
-------------------------- ---------- ---------- -----
/* connect to the db */
CONNECT 'C:\PROJECTS\test.GDB'
USER 'SYSDBA' PASSWORD 'masterkey';
/* prepare the output file */
OUTPUT "c:\projects\test_text.txt ";
SELECT "People: "||COUNT(*) from Person;
SELECT "Employees: "||COUNT(*) from Employee;
COMMIT;
-------------------------- ---------- ---------- -----
Once the script above is saved you can run it like this :
( assuming that isql.exe is in a path or it's copied to the local directory )
isql -i test_output.sql
does that help ?
Create an SQL file to run the desired queries:
( I called this one test_output.sql )
--------------------------
/* connect to the db */
CONNECT 'C:\PROJECTS\test.GDB'
USER 'SYSDBA' PASSWORD 'masterkey';
/* prepare the output file */
OUTPUT "c:\projects\test_text.txt
SELECT "People: "||COUNT(*) from Person;
SELECT "Employees: "||COUNT(*) from Employee;
COMMIT;
--------------------------
Once the script above is saved you can run it like this :
( assuming that isql.exe is in a path or it's copied to the local directory )
isql -i test_output.sql
does that help ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I thought I already accepted you comment as an answer.
Sorry for taking so long.
Kokjoh
Sorry for taking so long.
Kokjoh
Regards,
Bojidar Alexandrov