I got it wrong on the assumption that data type conversion would take precedence over concatenation or addition. Now I understand that while I'm correct about that, the precedence does not apply to the entire statement at once, but rather on a series of left-to-right pairs. Makes sense, I suppose.

Fortunately for me I would never consider doing this implicitly. That's just asking for trouble.

I am not a T-SQL person since I am primarily an Oracle DBA, but I did notice the single quotes and it make me think. The equivilent SQL in Oracle produces the same results: select '130' || '120' + 1 from dual;

ronmoses (8/21/2012)I got it wrong on the assumption that data type conversion would take precedence over concatenation or addition. Now I understand that while I'm correct about that, the precedence does not apply to the entire statement at once, but rather on a series of left-to-right pairs. Makes sense, I suppose.

Fortunately for me I would never consider doing this implicitly. That's just asking for trouble.

ron

Bit me for the same reason. Agree, I wouldn't do this implicitly either.

It's very interesting how this starts as a concatenation theme, but now it has become an implicit conversion issue. By the way, the only implicit conversion in wich I trust is string to datetime. It will always works if the string provided is in 'yyyymmdd' format.

ronmoses (8/21/2012)I got it wrong on the assumption that data type conversion would take precedence over concatenation or addition.

Made the same assumption. Since I had never implicitly converted like this, I was under the misapprehension that the datatype evaluation would go before the operations. Thanks to OP for posting, as I learned something today.

Please don't go. The drones need you. They look up to you.Connect to me on LinkedIn