首页 > 解决方案 > 如何使用表名查找数据库名?

问题描述

我发现我的系统中存在表名,我使用了以下查询;

select * from sys.tables where name = '%openpotab%';

但是如何使用表名找到数据库名呢?

在此先感谢, Bhavesh

标签: sql-server-2012

解决方案


你可以使用:

select DB_NAME(DB_ID()), * from sys.tables where name LIKE '%openpotab%';

推荐阅读