How do I list all tables in all databases in SQL Server in a single result set?

后端 未结 16 1233
轮回少年
轮回少年 2020-11-28 07:36

I am looking for T-SQL code to list all tables in all databases in SQL Server (at least in SS2005 and SS2008; would be nice to also apply to SS2000). The catch, however, is

16条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 07:43

    I'm pretty sure you'll have to loop through the list of databases and then list each table. You should be able to union them together.

提交回复
热议问题