The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-20-2008
arvindcgi arvindcgi is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 14
Connecting to sybase via shell script.

Hi All,

I was able to connect to sybase in shell script and also able to run few sql queries, something like this,

#!/usr/bin/ksh -x

temp=`echo "select name from sysobjects where type = 'U'"`
results=`isql -SDS_SERVER-UAdhocUser -Pha12 <<EOF
set rowcount 6
$temp
go
EOF`
line_count=0
echo "${results}" | while read line; do
echo "Line $((line_count = line_count + 1)) is ${line}"
done


But if suppose sql queries are stored in file called "sql_query.txt", then how should it be executed. (Above code is taken from this forum only )


Thanks in advance for help.

Last edited by arvindcgi; 05-20-2008 at 11:29 AM..