Baran Topal

Baran Topal


June 2018
M T W T F S S
« Feb    
 123
45678910
11121314151617
18192021222324
252627282930  

Categories


search and find a column in an MSSQL db with query

baranbaran

This is a handy script if you need to find a column in MSSQL db with query.


USEmydb
GO
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%keyword%'
ORDER BY schema_name, table_name;