The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Connecting to oracle database from shell script satyakiran Shell Programming and Scripting 5 07-16-2008 08:05 AM
sybase connection through shell-script Amitabh UNIX for Dummies Questions & Answers 7 06-19-2008 06:55 PM
error connecting sql through a shell script nehak Shell Programming and Scripting 1 04-30-2008 05:04 AM
Connect to sybase database using Korn shell script bhgopi Shell Programming and Scripting 7 08-10-2005 06:34 AM
Connecting DB in the Shell Script to do SQL Query mehuldoshi UNIX for Advanced & Expert Users 3 03-29-2003 08:47 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-20-2008
Registered User
 

Join Date: Jan 2008
Posts: 9
Stumble this Post!
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 07:29 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-20-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,837
Stumble this Post!
Change line #1 to read
Code:
temp=`cat sql_query.txt`
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0