|
|
Question : output parameter into unix variable
|
|
Hi all,
Been a while since I've been here. Howeverm I've got a new question. I'm trying to call a stored procedure from a unix shell script. So far, no problem. But in the stored procedure there is an outputparameter which I would like to put in a unix variable. This is giving me problems... I've tries a few things but so far, nothing. The sp works fine exept my unix-variable stays empty.
Any experience in this?
Code:
echo $1 isql $DB_CONNECTSTRING > log.txt <declare @iets varchar(10) exec aho_test @p_in = $1 , @p_out = @iets output go aho echo $iets cat log.txt
executed as: test 6 result: 6 <---- this is 'echo $1' <---- this is where the 'echo' of $iets should be. (return status = 0)
Return parameters:
@p_out ---------- groter
(1 row affected)
when I try it like this:
echo $1 isql $DB_CONNECTSTRING > log.txt <exec aho_test @p_in = $1 , @p_out = $iets output go aho echo $iets cat log.txt
then excute: test 6 this is the result: 6 <---- this is 'echo $1' <---- this is where the 'echo' of $iets should be.
(return status = 0)
Any one??
|
Answer : output parameter into unix variable
|
|
a slight change to get exactly what you want.
var=`isql -U.. <set nocount on declare @b char(2) exec xb @b output go select @b Sqlbatch ` echo $var | awk '{print $2}'
|
|
|
|
|