Home Forums SQL Server 2008 SQL Server 2008 - General Query result in SQL Server 2000 return correct and SQL Server 2008 R2 SP2 return wrong RE: Query result in SQL Server 2000 return correct and SQL Server 2008 R2 SP2 return wrong

  • antonio.estima 4150 (9/25/2012)


    Hello,

    We have a problem in the query within the attached file. When I run in sql server 2000 it returns the result without errors, but when I run the SQL Server 2008 R2 SP2 it returns the error message: Msg 245, Level 16, State 1, Line 1 Conversion failed converting the varchar value When 'PA 'to data type int.

    When I comment the line of the join "and w.unidade = b.Unidade" in SQL Server 2008 r2 sp2 works without showing any error. Now, the filter "where SUBSTRING (nomeint, 1,1) = 'P' ", which is in subquery is precisely to bring unit not equals "PA" and thus does not occur conversion problem, because the field b.unit is of type varchar and w.unidade is of type int.

    What could is happening? Someone help us?

    Query :

    Regards,

    Antonio Estima

    What data types are these: w.unidade, b.Unidade