如何列出SQL Anywhere中的所有用户表及其行数?

时间:2013-10-29 14:18:58

标签: sql sybase sqlanywhere

我想在我的数据库中列出所有可用的表,并能够按行数进行排序和筛选。

1 个答案:

答案 0 :(得分:10)

这很简单:

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

希望这会有所帮助......

更多信息:systable和syscolumn,自SQL Anywhere 10以来,只有传统向后兼容性视图,Sybase建议使用更新的系统表...因为我使用的是版本9和11,所以我坚持使用这些。

相关问题