How to remove not null constraint in sql server using query

后端 未结 4 1018
小鲜肉
小鲜肉 2020-12-24 04:03

I am trying to remove not null constraint in sql server 2008 without losing data.

相关标签:
4条回答
  • 2020-12-24 04:41
     ALTER TABLE YourTable ALTER COLUMN YourColumn columnType NULL
    
    0 讨论(0)
  • 2020-12-24 04:43

    Remove constraint not null to null

    ALTER TABLE 'test' CHANGE COLUMN 'testColumn' 'testColumn' datatype NULL;
    
    0 讨论(0)
  • 2020-12-24 04:56

    Reference: https://www.tutorialspoint.com/How-can-we-remove-NOT-NULL-constraint-from-a-column-of-an-existing-MySQL-table

    ALTER TABLE tableName MODIFY columnName columnType NULL;
    
    0 讨论(0)
  • 2020-12-24 05:01

    Remove column constraint: not null to null

    ALTER TABLE test ALTER COLUMN column_01 DROP NOT NULL;
    
    0 讨论(0)
提交回复
热议问题