I want to search for the date '2017-08-08 09:26' in all existing tables of a database and get the column name and table name of the table that contains that date. So I can find that date in table A in column a.
example: '2017-08-08 09:26' exists in column 'a' of table 'A'
Please give me some suggestions for a solution.
Right now I am using this query in which I can search for columns, but I want to search the data in the columns of the tables in my database.
SELECT
sys.columns.name AS ColumnName,
sys.tables.name AS TableName
FROM
sys.columns
JOIN
sys.tables
ON
sys.columns.object_id = sys.tables.object_id
WHERE
sys.columns.name LIKE '%service%'