This is a tool I wrote to find the schemas, tables, and columns affected by an unfortunate overbroad update query in SQL Server.
- Apologies for the usage of a cursor and dynamic SQL. If you have a good way to avoid either or both, please share your solution.
- It is tested on SQL Server 2014, probably works well on later versions, and may be useful on all versions 2008 and later, albeit perhaps with some syntactic adjustments.
- I have no idea how it handles DDL changes, so be careful if your schema isn't static.
- I have not yet tested its dynamic SQL bits against SQL injection.