Baran Topal

Baran Topal


August 2022
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  

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;