SQL Change null values for integer column

  • Hi All,

    In MSSQL How can I handle null values for integer column. Do I need to update null to zero maybe?

    I am doing BCP out from MSSQL to MYSQL.

    The text file is having null-empty values and MYSQL load is errors out with Incorrect integer value.

  • You could add a step to update your file before the BCP.

    or

    In your select, you could use a CASE statement to replace NULL with 0

    SELECT 
    CASE WHEN FIELD1 is NULL then 0 ELSE FIELD1 END
    , FIELD2, FIELD3
    from MYFILE

    • This reply was modified 2 years ago by  homebrew01.

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

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