You can send input to the isql command via the command line interface. Note the ESOFT string is arbitrary. I have also included reading SQL commands from a file. Here are the examples.
# isql -Usa -Pyourpassword -Syourserver_name << ESOFT > myoutput
use esoftdb
go
select count(*) from mysoft_table
go
ESOFT
View the results
# cat myoutput
Read SQL from a file
# isql -Usa -Pyourpassword -Syourserver_name < ESOFTFILE > myoutput
View the results
# cat myoutput
This blog covers Unix system administration HOWTO tips for using inline for loops, find command, Unix scripting, configuration, SQL, various Unix-based tools, and command line interface syntax. The Unix OS supports tasks such as running hardware, device drivers, peripherals and third party applications. Share tips/comments. Read the comments. But most importantly: Read Disclaimer - Read Disclaimer.
2 comments:
If you want to run Sybase TSQL commands in a shell script somewhere you can do it as follows (in your script):
isql -Usa -Pyourpassword -Syourserver_name <<-BOF
use esoftdb
go
select count(*) from mysoft_table
go
BOF
Also, reading from file can be a bit easier:
isql -Usa -Pyourpassword -Syourserver_name -i myoutput
Cheers,
David
David, Great tip!
Post a Comment