27,579
社区成员
发帖
与我相关
我的任务
分享
create table test(dtime datetime)
insert test
select '2009-9-9 15:44:40'
go
select count(*) from test where datediff(dd,'2009-9-9',dtime)=0
-----------
1
(所影响的行数为 1 行)
select count(1) FROM 表A where left(time,8)='2009-9-9'
--1
select count(*) from 表A where convert(varchar(10),Time,120) ='2009-09-09'
--2
select count(*) from 表A where datediff(day,datefield,'2009-9-9')=0
select count(1) FROM 表A where datediff(dd,''2009-9-9' ',[time])=0
select count(*) from 表A where convert(varchar(10),Time,120) ='2009-09-09'
select count(*) from 表A where datediff(day,datefield,'2009-9-9')=0
select count(1) FROM 表A where datediff(dd,''2009-9-9' ',[time])=0