Sql Server - Find column/tables by column/table name


Scenario:

Find all column/tables which has user in it.

Query:

In each database run below query


1
2
3
4
5
6
7
8
9
SELECT t.[Name] [Table Name],
       c.[Name] [Column Name],
       *
FROM   sys.columns c
       JOIN sys.tables t
         ON c.object_id = t.object_id
WHERE  c.[Name] LIKE '%user%'
ORDER  BY t.[Name],
          c.[Name] 

No comments:

Post a Comment

Move Github Sub Repository back to main repo

 -- delete .gitmodules git rm --cached MyProject/Core git commit -m 'Remove myproject_core submodule' rm -rf MyProject/Core git remo...