专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Sybase

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

发布时间:2010-05-20 14:01:29 文章来源:www.iduyao.cn 采编人员:星星草
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)

文件是这样的。。我晕
这样这个数字我得发很大力气给提出来啊,有没有好点的办法?
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: