我想列出数据库中所有可用的表,并能够按行数进行排序和过滤。
最佳答案
这很容易:
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成为唯一的向后兼容 View ,而Sybase建议改用较新的系统表...因为我使用的是版本9和11,所以我坚持使用这些表。
关于sql - 如何列出SQL Anywhere中的所有用户表及其行数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19660814/