The automation usability of the Unix Scripting can be enhanced with embedding the SQL queries into a Unix script file.
It can be achieved as mentioned in the below examples -
1.
isql -S
EOF
Use isql command with the aforesaid options.
<< EOF says, do the execution of the embedded sql after this command line till word "EOF" is encountered.
The output would be displayed on command prompt only.
2. isql -S
EOF
Same as above with one addition , the output can bbe redirected to a file with indirection ">". Here the output file is "analytics_result.txt"
3.
isql -S
EOF
In case of big queries or multiple query execution, all sql stuffs could be packaged into a sql file and the file path could be mentioned with the option "-i".
Scope -
This automation could be used for database functionalities and running database queries as a scheduled job.
Avaneesh
07-01-2009
No comments:
Post a Comment