猿问
查找所有包含具有指定名称的列的表-MS SQLServer
查找所有包含具有指定名称的列的表-MS SQLServer
是否可以查询包含列的表名?
LIKE '%myName%'
?
慕容708150
浏览 602
回答 3
3回答
尚方宝剑之说
搜索表:SELECT c.name AS 'ColumnName' ,t.name AS 'TableName'FROM sys.columns cJOIN sys.tables t ON c.object_id = t.object_idWHERE c.name LIKE '%MyName%'ORDER BY TableName ,ColumnName;搜索表和视图:SELECT COLUMN_NAME AS 'ColumnName' ,TABLE_NAME AS 'TableName'FROM INFORMATION_SCHEMA.COLUMNSWHERE COLUMN_NAME LIKE '%MyName%'ORDER BY TableName ,ColumnName;
0
0
0
慕勒3428872
我们还可以使用以下语法:select * from INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME like '%clientid%' order by TABLE_NAME
0
0
0
随时随地看视频
慕课网APP
相关分类
MySQL
SQL Server
我要回答