【发布时间】:2013-11-08 18:15:59
【问题描述】:
我想列出我的数据库中所有可用的表,并能够按行数排序和过滤。
【问题讨论】:
标签: sql sybase sqlanywhere
我想列出我的数据库中所有可用的表,并能够按行数排序和过滤。
【问题讨论】:
标签: sql sybase sqlanywhere
这很简单:
select table_name, count
from systable
where primary_root<>0 and creator=1
order by 1
或者如何添加列数和名称?
select t.table_name, t.count rows, count(*) cols,
list(c.column_name order by c.column_id) col_list
from systable t
left outer join syscolumn c on c.table_id=t.table_id
where t.primary_root<>0 and t.creator=1
group by t.table_name, t.count
order by 1
希望这会有所帮助...
更多信息:从 SQL Anywhere 10 开始,systable 和 syscolumn 仅支持旧版向后兼容视图,而 Sybase 建议改用较新的系统表...因为我使用的是版本 9 和 11,所以我坚持使用这些。
【讨论】: