Home  >  Article  >  Database  >  查找本库包含某字段的所有表

查找本库包含某字段的所有表

WBOY
WBOYOriginal
2016-06-07 15:55:491165browse

数据库表格多了,想找出包含某个字段的所有表。 --syscolumns 和 sysobjects 是数据库 维护的 列集表 和 表集表SELECT col.name TableName FROM syscolumns col JOIN sysobjects tab ON col.id = tab.id AND tab.type=U AND col.name=Phone

数据库表格多了,想找出包含某个字段的所有表。

--syscolumns 和 sysobjects 是数据库 维护的 列集表 和 表集表
SELECT col.name  TableName   
  FROM syscolumns col  
  JOIN sysobjects tab ON col.id = tab.id    
   AND tab.type='U'    
   AND col.name='Phone'


 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn