SQL技巧:创建用来按小时报告的查询
create table test (starttime datetime not null default current_timestamp, startdate datetime not null default convert(datetime, convert(char(10),current_timestamp, 110)), starthour int not null default datepart(hh,current_timestamp), trantype int not null constraint ck_trantype check ( trantype in ( 1, -- insert 2, -- update 3, -- delete ) default 1 ) go




