insert values to a TABLE with columns with NULL

  • I have a TABLE with unique id's and values.

    But i have some NULL values in 2 of the columns

    What is the best way to insert values into the NULL columns

    THese 2 columns have all NULLS in them.

    And i want to replace them with current year and current month

  • fixed my brain was asleep

  • dont know if i have understood ur problem correctly but this what i have to say.....

    This will update column1 with current year and column2 with current month where ever column1 or column2 have null values.

    update Table1 SET column1 = year(getdate()) columns1 IS NULL

    update Table1 SET column2 = year(getdate()) where  columns2 IS NULL.

     

    "Keep Trying"

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

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