The below query filters on two columns in the
WHERE clause. Both columns are of
VARCHAR datatype. Purely by mistake I ran the query without putting single quotes around the
column2 values and it ran successfully and return the correct result set.
WHERE column1 = 'QTR12345678'
AND column2 IN (120012, 220015)
Note: if I only search on
column2 then I get the expected error
Conversion failed when converting the varchar value...
It seems like the SQL engine implicitly converts the value from numeric to
varchar is this instance. Why?
(I'm using SQL Server 2012 SP2)