读书人

unix 下操作sybase 有关问题.各位不吝

发布时间: 2012-02-12 17:16:33 作者: rapoo

unix 下操作sybase 问题.各位大虾不吝赐教
在hp-ux下通过shell连接数据库.
通过一个查询语句如下:
select count(*) ct from t1
union all
select count(*) ct from t2
union all
select count(*) ct from t3
...
我想获得这个返回各列的查询结果,在怎么搞?有没有办法用shell变量去接受这个返回结果。
或者另一个办法就是把查询结果直接导出成文件,再从文件中读。
怎么导出文件,请各位帮帮忙~

我知道在ORACLE下可以
sqlplus -s uname/pwd@instance << EOF
spool /home/user/txt;
select count(*) ct form t1 unoin all ...
spool off;
EOF

Sybase 下怎么实现呢??

[解决办法]
isql -Usa -P*** -S<Server> <<EOF>out.txt

select count(*) ct form t1 unoin all ...
go
EOF
[解决办法]

探讨

$cat out.txt
count(*)
--------------------
7925

(1 row affected)

文件是这样的。。我晕
这样这个数字我得发很大力气给提出来啊,有没有好点的办法?

读书人网 >Sybase

热点推荐