I want to add another column having a COUNT() subquery using the table and column names from TBL_A.TABLE_NAME and TBL_A.COLUMN_NAME respectively but the subquery does not accept the value from TBL_A.TABLE_NAME as a valid table object.
Currently using MS SQL server
SELECT TBL_A.TABLE_NAME
, TBL_A.COLUMN_NAME
, TBL_A.DATA_TYPE
, (SELECT [TBL_A].[COLUMN_NAME] FROM [TBL_A].[TABLE_NAME] WHERE [TBL_A].[COLUMN_NAME] = 'Some Keyword')
FROM INFORMATION_SCHEMA.COLUMNS AS TBL_A;
I want to check if the keyword I entered is present in the specified tablename.columnname in INFORMATION_SCHEMA (e.g. COUNT > 0 thus is PRESENT)