sql server 设置了一个datetime类型的字段  怎么设置默认值为1999 - 9 -9  这种形式的??

解决方案 »

  1.   

    create table test
    (
    id int,
    times datetime
    )
    go 
    CREATE DEFAULT DF_COL AS '1999-09-09';
    GO
    sp_bindefault DF_COL, 'test.times';
      

  2.   

    if object_id('test') is not null 
    drop table test
    go
    create table test
    (
        id int,
        times datetime default('1999-9-9')
    )
    go insert test(id)
    select 1select * from test
    (1 行受影响)
             id times
    ----------- -----------------------
              1 1999-09-09 00:00:00.000(1 行受影响)
      

  3.   

    你好。我在插入数据库的时候,insert into student values(4,'king',3),该语句提示::::插入错误: 列名或所提供值的数目与表定义不匹配。这个是什么原因??