不删除字段
只把某个字段的NOT NULL条件去掉如何处理

解决方案 »

  1.   

    ALTER TABLE ALTER COLUMN NVARCHAR(20)  NULL
      

  2.   


    alter table ta ALTER  column colname type null
      

  3.   

    ALTER TABLE tablename Drop CONSTRAINT 约束名
      

  4.   

    use tempdb
    goif object_id('#temp') is not null
    drop table #temp
    create table #temp(id int not null
    ,name char(20) not null)
    --查看表结构
    exec sp_help #temp--去掉not null
    alter table #temp
    alter column name char(20) null--再查看表结构
    exec sp_help #temp
      

  5.   


    ALTER TABLE ALTER COLUMNname type  NULL 
      

  6.   

    ALTER tabname ALTER COLUMN colname type  NULL 
      

  7.   

    ALTER table tabname  ALTER COLUMN columname  type  NULL 
      

  8.   

    要是在列上建立了其他对象,如索引,就不能更改NOT NULL了
    这种情况如何处理
      

  9.   

    Create table a (a int not null)ALTER table a  ALTER COLUMN a int  NULL exec sp_help a--查看系统结构