我在 Azure SQL 数据库中工作。我想找到多个数据库共有的所有表,但未能做到这一点。
我是“管理员”级用户,但是当我执行[select * from sys.tables]
时
在主数据库中,我没有获得 Azure 服务器上 7 个数据库的结果。
从 Azure SQL 数据库中的所有数据库中选择所有表的方法是什么?
最佳答案
运行此查询以列出 SQL Azure DB 上的所有用户表以及每个表中的记录数
select t.name ,s.row_count from sys.tables t
join sys.dm_db_partition_stats s
ON t.object_id = s.object_id
and t.type_desc = ‘USER_TABLE’
and t.name not like ‘%dss%’
and s.index_id = 1
关于sql-server - Azure SQL 数据库查找与特定表关联的所有数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46616301/