Hi
I am having an inconsistent issue being produced on one of my servers whereby I have the following
Select *
from SomeVarcharTable v
join SomeIntTable i on i.MyInt=v.MyVarchar
Where v.Id = SomeID
The "MyVarChar" column is surprisingly of type varchar, and "MyInt" is of type int.
Whats curious is that when I run this on my development instance of Sql 2000, I receive no error.
When I run this on my Live instance of Sql 2000 I receive the following error:
Syntax error converting the varchar value '1.4' to a column of data type int.
Does anyone know of any server settings which might cause this. I have gone so far as to do a restore of my production database to my development system and the error doesn't occur.
I wondered whether it was something to do with the sql query engine, but this was working without an issue a few days ago.
Also, I am aware that this is not best practice, and that I could fix the above query by this:
Select *
from SomeVarcharTable v
join SomeIntTable i on cast(i.MyInt as varchar)=v.MyVarchar
Where v.Id = SomeID
I am more interested at this stage in wondering why the issue has been caused, so I can educate others in my company
Thanks in advance
Mark.