Convert Varchar to numeric

  • OK here is my issue.

    I have a set of numeric fields in a database that have a value of null.

    I have a trigger set on the database to do a comparison of the existing data against the new data that is set to update the row.

    I am using SQL 7 with sp4   but every time the trigger runs  it assumes that the NULL value is a varchar and refuses to compare it agaist the numeric value.

    I need to run a convert statement to convert the old null varchar value to a numeric value of 0 to allow the comparison to take place.

     

    Any ideas?

    I will include the trigger if I have to.

     

     

  • Use:

     

    isnull(dbColumn,0)

     

    If it is null, it will use 0.


    ------------------------------
    The Users are always right - when I'm not wrong!

  • If the field should not ever be null, shouldn't you change the field to have a not null constraint?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply