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

标签 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成为唯一的向后兼容 View ,而Sybase建议改用较新的系统表...因为我使用的是版本9和11,所以我坚持使用这些表。

关于sql - 如何列出SQL Anywhere中的所有用户表及其行数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19660814/

相关文章:

php - 在php中创建一个多步骤表单

asp.net - 尝试使用 "Insert into"ms-access 数据库时出错

sqlanywhere - 从 Sybase 事务日志文件中解码信息

sql - 从 postgresql 中的数组中选择以获得所有可能的结果

sql - 在postgres查询中获取第一行

java - 一个可以检测冗余数据库表的工具

MySQL mobillink 与 SQL Anywhere 同步

php - 代码点火器 3.1.10 : Cannot connect to remote database by DSN using ODBC

java - 在 Hibernate for Sybase DB 的多语句事务中不允许使用 SELECT INTO 命令

java - 在 ibatis 中使用 in 子句