JasonRowland (8/4/2012)
Ok, I think I understand why this is. There is an implicit conversion from varchar to int and you might think that when converting '' to int it would be null. But null isn't an int, it isn't anything. So, it converts it to 0. I would rather get a type conversion error though.
In your sample as you stated it is a zero length string, and NOT null, if it were null your result would be:
DECLARE @MyINT int = 0;
declare @MyVarChar varchar(12) = NULL;
IF @MyINT = @MyVarChar
PRINT 'TRUE! 0 equals ''''';
ELSE
PRINT 'FALSE!';
Result:
FALSE