Skip to Content.
Sympa Menu

freetds - [freetds] freetds in a shell script

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Stephen Prowse" <stephen.prowse AT db.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] freetds in a shell script
  • Date: Wed, 1 Dec 2004 08:49:16 +1100

We have in the past written many shell scripts using sqsh , or isql, in
the form

sqsh -U -P -S << EOF | sed 's/{tab}$//'> file #where {tab} is the control
character for tab
select something
from somewhere
whre things match.
EOF

Process the results

Repeat the command with a different sql statement<<EOF2
sql statement2
EOF2
....

When trying with freetds , version 0.62.4 , with the same structure the
commands after the first EOF are ignored. We can get around this by
calling the sql in separate scripts from a parent but it adds to the
maintenance. Could anyone advise a way to get the above to work?

Also is there a way to suppress the following and turn off headers? As you
can see we are new to freetds and I can't find anything related on google.
I'd continue to use sqsh but from what I can see it won't work against
MSSQL.

-All commands return this
locale is "C"
locale charset is "646"

-If I put each column on a separate line I get the line numbers echoing
and would like a way to suppress this as well. While we can use sed to cut
out the extraneous stuff it is quite variable and adding data adds extra
work.

ie 1> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20>
21> 22> 23> 24> 25> 26> 27> 28> 29> 30> 31> 32> 3
3> 34> 35> 36> 37> 38> 39> 40> 41> 42> 43> 44> 45> 46> 47> 48> 49> 50> 51>
52> 53> 54> 55> 56> 57> 58> 59> 60> 61> 62> 6
3> 64> 65> 66> 67> 68> 69> 70> AccID Acc etc

I've tried 2>>/dev/null with no effect

Any help appreciated.

Steve Prowse
Sydney




Archive powered by MHonArc 2.6.24.

Top of Page