Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009
    Posts
    7

    Unanswered: how to pass values from sybase session to unix script. Help !!!

    #!/usr/bin/ksh


    export TF_BASECOUNT =$1

    #---------------
    isql -U xy -P $PASSWORD -S SS2 <<-!

    use ARO
    go
    select @@servername as "SERVER:", db_name() as "DATABASE:"
    go
    begin
    SELECT <somevar> = COUNT(1)
    FROM ARO.usr.HISTORY_TEMP
    END
    print "Base Count : %1!",<somevar>
    end
    go
    exit
    !

    I need this <somevar> here, that is in unix script.
    can it be done !!!.... help

    exit

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    You'll have to read it from the log file e.g.
    Code:
    var=`grep 'Base Count :' /tmp/xx.log | cut -d: -f2`

  3. #3
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Another example, doing something for each mz database
    Code:
    #!/usr/bin/ksh
    getdbnm()
    {
    isql -U me -P `cat ~/.mysrv` -S mysrv -b -n <<EOF
    set nocount on
    select name from sysdatabases where name like 'mz&#37;'
    go
    EOF
    }
    for n in $(getdbnm)
    do
    ...etc.
    Last edited by pdreyer; 03-01-10 at 04:25.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •