I was looking into some code and some bug caught my eye. Someone compared tinyint column with varchar value.
But surprisingly this is working (as intention was to compare with numeric value 0).
Sample Query:
create table t1(x1 tinyint);
insert into t1 values (0),(0), (1), (2);
select * from t1 where x1 = 'live'
Result:
x1
0
0
My question is why (any) varchar value behaves the same way as numeric value 0 for int/tinyint column?
varcharvalue with a column of arbitrary type is a general "search" field, which searches all columns to contain a given value.