Thursday, 28 December 2017

Query to Find Column From All Tables of Database

USE AdventureWorks
GO
SELECT t.name AS table_name,SCHEMA_NAME(schema_idAS schema_name,c.name AS column_nameFROM sys.tables AS tINNER JOIN sys.columns c ON t.OBJECT_ID c.OBJECT_IDWHERE c.name LIKE '%EmployeeID%'ORDER BY schema_nametable_name;
SQL SERVER - Query to Find Column From All Tables of Database GetColumn
In above query replace EmployeeID with any other column name.
SELECT t.name AS table_name,SCHEMA_NAME(schema_idAS schema_name,c.name AS column_nameFROM sys.tables AS tINNER JOIN sys.columns c ON t.OBJECT_ID c.OBJECT_ID 
ORDER BY schema_nametable_name;
SQL SERVER - Query to Find Column From All Tables of Database AllColumns

No comments:

Post a Comment