Baran Topal

Baran Topal


September 2018
M T W T F S S
« Feb    
 12
3456789
10111213141516
17181920212223
24252627282930

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;