Dynamically generated code T-SQL code can cause trouble

A poorly written query can code trouble if the SQL server cannot predict a good execution plan because of too many type conversation and varchar max parameters:

SQL Server CPU usage
SQL Server CPU usage
Dynamically generated T-SQL code
Dynamically generated T-SQL code

After changing the code

CPU usage after code changes
CPU usage after code changes

 

Leave a Reply

Your email address will not be published. Required fields are marked *