• sql2k8 (6/25/2013)


    I will change the code like what you had said but when it was having issues with the Test_Code Column in the Table_Test1 . It should throw an error message like it cannot convert 1000 to 1001 but why was it throwing an error message like the one mentioned below.

    Conversion failed when converting the varchar value '2314K' to data type int. [SQLSTATE 22018] (Error 245).

    Because you used this

    update Table_Test1 set Test_Code=1001 where Test_Code=1000

    instead of this

    update Table_Test1 set Test_Code='1001' where Test_Code='1000'

    Your version forces SQL Server to attempt to convert the column to an INT in order to compare it with 1000. Version 2 uses the literal text.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.