If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > how to pass variable to sybase script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-05-11, 15:39
annaNJ annaNJ is offline
Registered User
 
Join Date: Jun 2011
Posts: 5
how to pass variable to sybase script

Hi,

I like to write a simple query, but just can't pass to sybase query


#!/bin/ksh
export key1=$1
isql -Umy_id -Smy_DB -Pmy_passwd << EOF
select * from my_table
where id like "%key1%"
go
exit
EOF


but it just does not return anything.
Reply With Quote
  #2 (permalink)  
Old 07-06-11, 13:17
pradyut.dhara pradyut.dhara is offline
Registered User
 
Join Date: May 2011
Posts: 28
how to pass variable to sybase script

Hi,
Write the query in a sql file.
Then replace the variable in sql file using sed command.
Now run the sql file
isql -Umy_id -Smy_DB -Pmy_passwd -i<sql file> -o<Output file>
Reply With Quote
  #3 (permalink)  
Old 07-08-11, 11:10
annaNJ annaNJ is offline
Registered User
 
Join Date: Jun 2011
Posts: 5
I figure out what the problem is....as I just "modified" from a script
i put the -o option, hence it sends to a file
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On