SQL Server adds implicit data type conversions when types don’t match.  This can have unintended results both on query results, but also on the query plan.  It is important to use literal constants that match in type column they are being compared with wherever possible.  A common mistake in writing T-SQL is to always use string literals for constants even when those constants are numbers, for example.


WHERE Quantity = ‘100’

In this example, ‘100’ is a character string while the column Quantity is an integer.  The implicit conversion used follows strict precedence rules.  Here the conversion will be on Quantity to character string, and not on the ‘100’ to an integer.