Sybase ASA (11及以后版本)中获取表定义的SQL语句及SP

ASA功能本来非常强大, 可是不理解为什么没有一个功能强大的描述一个表定义的简单的SQL语句。
像Oracle中:desc <table_name>
MySQL中:show create table <table_name>
都非常简单明了。

ASE里头,至少有个命令行:DDLGEN, 在$SYBASE/ASEP/bin 目录里头可以用。

可是到了ASA当中,用起来相当不顺利,至少很难一下子记住。

它要使用到 sa_get_table_definition存储过程,这还不够,不能直接显示结果,必须结合过程:sa_split_list一起才能达到效果。

请看下例:

select row_value from sa_split_list( sa_get_table_definition('DBA', 'djc_pc'), char(10));


查询一个结果集的各列属性,可以用:
select * from sa_describe_query('select * from djc_pc')
结果如下:

1 pc_cid 27 decimal decimal(20,0) 20 0 20 null null djc_pc 731 1 DBA djc_pc pc_cid 0 0 null null
2 pc_partition 9 varchar varchar(255) 255 0 255 null null djc_pc 731 2 DBA djc_pc pc_partition 0 0 null null
3 pc_cycle 2 int int 4 0 4 null null djc_pc 731 3 DBA djc_pc pc_cycle 1 0 null null
4 pc_owner 9 varchar varchar(255) 255 0 255 null null djc_pc 731 4 DBA djc_pc pc_owner 1 0 null null
5 pc_timeout 27 decimal decimal(20,0) 20 0 20 null null djc_pc 731 5 DBA djc_pc pc_timeout 1 0 null null




<script type="text/javascript"><!-- google_ad_client = "ca-pub-7104628658411459"; /* wide1 */ google_ad_slot = "8564482570"; google_ad_width = 728; google_ad_height = 90; //--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值