Why stitching SQL statements faster than a parameterized query

When using parameterized queries, if only the specified parameter name, parameter value, which is lower than the efficiency of a pure SQL statement (or splice); while, if the specified parameter name, value type, length (string) is higher than the efficiency of pure SQL statement (or splice). Explain the Internet to find is: Hit the query plan.

My test conditions:
SQL2008R2 600W record

final conclusion: If the record rarely, or only a query, the efficiency advantage of parameterized queries is not obvious, or even poor. Of course, this does not mean that you can abandon the use of parameterized queries, at least it is safer than forget it.

Guess you like

Origin www.cnblogs.com/liuslayer/p/11968216.html