I would like to update all columns with column name 'USER_KEY' to value 'admin'. Is this possible to do?
I can get all table and column names with a specified column name with the following sql script:
SELECT c.name AS 'ColumnName'
,t.name AS 'TableName'
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%USER_KEY%'
ORDER BY TableName
,ColumnName;
But I don't know how to use these in an update statement.