Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Passing parameters from shell script?

349 views
Skip to first unread message

Michelle Warner

unread,
Dec 7, 1999, 3:00:00 AM12/7/99
to
I have a shell script which is being called from another application
with parameters. The shell script issues the isql command which
includes and input file. The input file executes a stored procedure
which requires arguments. Is there anyway for me to pass the parameters
passed to the shell script to the stored procedure? Thanks in advance.

--
Peace,
Michelle

I am too blessed to be stressed.


http://home.sprynet.com/sprynet/hrdbdy

http://www.ebonyelegance.com
A Premiere Web Site About African-Americans
Establishing Our Presence On The Web

ICQ# 17965901 - http://www.icq.com
AOL Screen Name - mdwarne

Fred

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
Hi Michelle,

You can use the following way to pass shell variables to isql scripts:

#!/bin/sh

param1=VALUE1
param2=VALUE2

isql -Uusername -Ppassword -Sservername<<EOF
# Any SQL statements
exec proc_name $param1,$param2
go
EOF

Hope this helps!

Fred.

In article <384DA6C5...@sprynet.com>,


Sent via Deja.com http://www.deja.com/
Before you buy.

Reinoud van Leeuwen

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
On Tue, 07 Dec 1999 19:31:02 -0500, Michelle Warner
<hrd...@sprynet.com> wrote:

>I have a shell script which is being called from another application
>with parameters. The shell script issues the isql command which
>includes and input file. The input file executes a stored procedure
>which requires arguments. Is there anyway for me to pass the parameters
>passed to the shell script to the stored procedure? Thanks in advance.

Yes, in Korn shell it works likes this

isql -U$USER -P$PASS -S$SERVER -o logfile <<-EOI
/* SQL code until EOI */
use mydb
go
sp_mystoredproc @param1 = "$UNIX_ENVIRONMENT_VAR"
go

EOI
# rest of Unix script
# (parse output in logfile)
__________________________________________________
"Nothing is as subjective as reality"
Reinoud van Leeuwen rei...@xs4all.nl
http://www.xs4all.nl/~reinoud
__________________________________________________

Ronald van Rijn

unread,
Dec 10, 1999, 3:00:00 AM12/10/99
to
Michelle,


If you use the unix parameter as an input parameter for the sp, it will
work.

Ronald

Michelle Warner wrote:

> I have a shell script which is being called from another application
> with parameters. The shell script issues the isql command which
> includes and input file. The input file executes a stored procedure
> which requires arguments. Is there anyway for me to pass the parameters
> passed to the shell script to the stored procedure? Thanks in advance.
>

0 new messages