NOT NULL columns without default

Hi there,
I have inherited the development of a data warehous and a colleague set the NOT NULL property to some columns in some tables without specifying a default value.
If I now create a deployment script and add some additional columns with the same set up and even only considering the ones already present, the deployment script created with SQL compare cannot be executed without errors.

Do you have a recommendation of how I can proceed in this matter?
Do I need to specify a default value for all NOT NULL columns to get around this? 

Answers

  • Hello, 

    Setting a default value for NOT NULL columns is the simplest way to get around this problem. You could also try to populate the column with a valid value, for example: 

    UPDATE <table>
    SET <column> = 'value'
    WHERE <column> IS NULL; 

    Then you could do your comparison and deployment. 



Sign In or Register to comment.