sql-server - How to find database name of any table
问题描述
How to find the database name for a particular table when we have created a table and we forgot the database where we have created the same.
解决方案
试试这个 EXEC sp_MSforeachdb
EXEC sp_MSforeachdb 'USE ? SELECT sc.TABLE_CATALOG, sc.TABLE_SCHEMA, sc.TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS sc WHERE TABLE_NAME=''YourTableName'''
推荐阅读
- go - 运行 go fmt ./... 在不同的操作系统上得到不同的行为
- java - 提交表单时无法将类型“java.lang.String”的值转换为所需类型“java.lang.Long”错误
- math - 如何计算方程中的运算符和操作数?
- c++ - 在函数中拥有函数原型的目的是什么?
- reactjs - React hooks 从子组件设置父数据
- c - XLIB 窗口管理器中的终端未接收来自屏幕键盘上“OnBoard”的按键
- html - 如何阻止 img:hover 从 800px 及以上影响 CSS?
- c++ - C++ curl post在curl_easy_perform超时
- javascript - 如何在 React 中渲染和替换对特定标签的更改?
- c# - 在 ASP.NET 中预加载 SQL 数据绑定列表视图