I am a SQL Server DBA. I would like to write a procedure which I can provide to rest of my team where they can view the text for currently running queries on the server (Similar to how we view in sp_who2) but with all the values masked. Examples:
| Query text | Query text after Masking |
|---|---|
| Select * from sometable where rating = '4' | Select * from sometable where rating = '****' |
| Select name, id from sometable where id = '3233' | Select name, id from sometable where id = '****' |
| UPDATE Customers SET ContactName = 'Alfred Schmidt' WHERE CustomerID = 1; | UPDATE Customers SET ContactName = '****' WHERE CustomerID = ****; |
| INSERT INTO Customers (CustomerName, ContactName) VALUES ('Cardinal', 'Tom B. Erichsen'); | INSERT INTO Customers (CustomerName, ContactName) VALUES ('*****', '****'); |
'.*?'with'****'.