create table 受理登记表
(
id int identity(1,1),
name varchar(10) not null,
systime ????????
)请问如何在插入一条新记录时。
1、systime 列 自动添加上sql服务器 当前系统日期时间??
2、如何让添加的时间格式为 2009-2-15 21:10:03?

解决方案 »

  1.   

    systime DATETIME DEFAULT GETDATE()
      

  2.   

    create table 受理登记表 

    id int identity(1,1), 
    name varchar(10) not null, 
    systime as getdate()
    ) insert into 受理登记表 values('test')select * from 受理登记表 drop table 受理登记表/**
    id          name       systime                                                
    ----------- ---------- ------------------------------------------------------ 
    1           test       2009-02-16 19:17:09.173(所影响的行数为 1 行)
    **/
      

  3.   

    create table 受理登记表 

    id int identity(1,1), 
    name varchar(10) not null, 
    systime datetime default getdate() 
      

  4.   

    create table 受理登记表 

    id int identity(1,1), 
    name varchar(10) not null, 
    systime as convert(char(19),getdate(),120)
    ) insert into 受理登记表 values('test')select * from 受理登记表 drop table 受理登记表/**
    id          name       systime             
    ----------- ---------- ------------------- 
    1           test       2009-02-16 19:18:58(所影响的行数为 1 行)
    **/
      

  5.   

    点名感谢ID:josy !!!!!3q3q3q3q3q3q3q3q3q3q3q3q3q3q3q!