I want to alter the procedure sys.sp_executesql in the master database (in the enhanced procedures folder or whatever that’s called in English) because I want the procedure to print everything I pass to it.
My code is getting a bit ugly and bloated with all the…
if @d=1 print @sqlstatement (@d für debug)
…statements in front of my dynamic SQL execute statements. I have to do this because SSMS will not tell be the line number of an error of dynamic SQL. I print all the dynamic SQL before execution so that I know exactly what dynamic sql came before the error.
How I get rid of all the print statements to clean my code?
Simply find them all and erase, what else?
Or find the code, which produces this dynamic sql and modify it for non-producing such a code.