本文介绍了SQL查询以搜索所有表的架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在处理其中有许多表(大约200个)的SQL Server 2008 Db。这些表中的许多表都包含一个名称为 CreatedDate的字段。我正在尝试使用此特定字段标识所有表架构。
I am working on a SQL Server 2008 Db that has many tables in it (around 200). Many of these tables contain a field by the name "CreatedDate". I am trying to identify all the table schema with this particular field.
是否有SQL查询可以做到这一点?
Is there a SQL query to do this?
推荐答案
我会查询information_schema-它的视图比基础表更具可读性。
I would query the information_schema - this has views that are much more readable than the underlying tables.
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%create%'
这篇关于SQL查询以搜索所有表的架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!