I want to query and see which table do not have a column called hello
.
I first use a query from this question: Find all tables containing column with specified name - MS SQL Server
SELECT c.name AS 'ColumnName'
,t.name AS 'TableName'
,c.object_id
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE t.name in (select colname from someTable) -- table with one column containing table names.
So this gives me a table in long format i.e. every table has many rows. Now I want figure out which table does not have a column called hello
.