insert fech select 1,'2001-10-01'
union all select 2,'2001-10-01'
union all select 3,'2001-10-03'
union all select 4,'2001-10-03'
union all select 5,'2001-10-04'
union all select 6,'2001-10-01'
select * from fech
select * from fech where datepart(dd,thistime)=1
如果你频繁这样查询的话,建议你创建一个存储过程。
create proc pr1
@day int
as
select * from fech where datepart(dd,thistime)=@day