TIL: Three Tricks to Debug Your Dynamic SQL Queries

from blog Just Some Code, | ↗ original
These three tips will help you to troubleshoot your dynamic queries and identify the source of a dynamic query when you find one in your query store or plan cache. To make dynamic SQL queries easier to debug, format the generated query with line breaks, add as a comment the name of the source stored procedure and use a parameter to only print the...