📜  当我不知道它在哪个表中时,在 sql db 中搜索列名 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:20.554000             🧑  作者: Mango

代码示例3
SELECT      c.name  AS 'ColumnName'
            ,t.name AS 'TableName'
FROM        sys.columns c
JOIN        sys.tables  t   ON c.object_id = t.object_id
WHERE       c.name LIKE '%MyName%'
ORDER BY    TableName
            ,ColumnName;