sql server 字段初始值为0而不是"null"

解决方案 »

  1.   

    -->用默认值if object_id('tempdb.dbo.#') is not null drop table #
    create table #(id int, data int default(0))
    insert # (id) select 100
    select * from #
    /*
    id          data
    ----------- -----------
    100         0
    */
      

  2.   

    create table aa(Id int,num int)alter table aa  add constraint DF_aa_NUm  default(0) for numinsert into aa(id) select 1select * from aa
    Id          num
    ----------- -----------
    1           0(1 行受影响)
      

  3.   

    重薪诚聘C++ 
    http://topic.csdn.net/u/20080227/14/8bce0844-bd15-42f0-9cda-a343d5d6601b.html