Re: fisql or ssqldb or sqsh.....

Keehan Mallon <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
I just finished changing our code to work using bsqldb with the -i, -o, -e syntax.  I would have used the here-doc syntax if I thought it was supported.  I looked at the man page, but didn't understand that here-doc style was an option.  I guess I should have got that from the statement that bsqldb is a filter and can use standard input, output and error.

Thanks for the reply.  It seems like a very easy to use utility.  It is very nice that the FreeTDS utilities are so compatible with the MS utilities.  I have now ported bcp to freebcp and osql to bsqldb.

Cheers,

Keehan




________________________________
From: James K. Lowden <[email protected]>
To: Keehan Mallon <[email protected]>; FreeTDS Development Group <[email protected]>
Sent: Tuesday, May 19, 2009 10:17:14 PM
Subject: Re: [freetds] fisql or ssqldb or sqsh.....

Keehan Mallon wrote:
> I need to be able to issue something like:
> 
> fisql -S $tdsname -U $user -P $password -Q $SQL

Why not use a here-document:

$ cat t.sql
#! /bin/sh

bsqldb -U$U -P$P -S$S <<SQL
select type, xusertype, allownulls
from systypes
where variable = 1
SQL

$ ./t.sql
type  xusertype  allownulls
----  ---------  ----------
  39        231           1
  39        256           0
  37        165           1
  39        167           1
4 rows affected

Adding a -C or -Q option to bsqldb wouldn't be hard, but reading from
standard input is much more flexible.  

HTH.  

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.