AndrewSQLDBA (10/3/2013)
Sorry, but I do not see any example using Dynamic SQL. I see the examples using straight Transact SQL.I NEVER, EVER use Dynamic SQL. No matter what.
Andrew SQLDBA
Dynamic SQL has it's place. In this example it's to prevent compilation errors. There are no avenues for injection in this code. I also use dynamic sql for maintenance operations.
Just because a tool is widely misused doesn't mean it shouldn't be used at all.