select * from table where CONVERT(nvarchar(7), datatime, 111)=2002/2/2 應該可以的
可以的啊!怎么会不可以呢? 我试过了!是可以的! select * from table where datatime='2002-2-2 12:00:00'
也可以用这样啊!! select * from table where datatime like '2002-2-2%'
这样可以 select * from table where convert(varchar(10),datatime,120)='2002-02-02'
可能要把毫秒都弄上去啊! select * from ExternalCandidate where dTestDate ='2002-2-2 12:00:00.000'
select * from table1 where CONVERT(nvarchar(7), datatime, 120)='2002-2-2' select *, cast([datetime] as varchar) as a from table1 where where left(a,8)='2002-2-2'
--要简单的话 select * from table where datediff(day,[datatime],'2002-2-2')=0 --要效率的话 select * from table where [datatime]>='2002-2-2' and [datatime]<'2002-2-3'
如果我原来就有小时什么的呢 select * from ExternalCandidate where dTestDate ='2002-2-2 12:00:00.000' 这个还行吗
我自己现在就是用的这个 要效率的话 select * from table where [datatime]>='2002-2-2' and [datatime]<'2002-2-3'
應該可以的
我试过了!是可以的!
select * from table where datatime='2002-2-2 12:00:00'
select * from table where datatime like '2002-2-2%'
select * from table where convert(varchar(10),datatime,120)='2002-02-02'
select * from ExternalCandidate
where dTestDate ='2002-2-2 12:00:00.000'
select *, cast([datetime] as varchar) as a from table1 where where left(a,8)='2002-2-2'
select * from table where datediff(day,[datatime],'2002-2-2')=0
--要效率的话
select * from table where [datatime]>='2002-2-2' and [datatime]<'2002-2-3'
select * from ExternalCandidate
where dTestDate ='2002-2-2 12:00:00.000'
这个还行吗
要效率的话
select * from table where [datatime]>='2002-2-2' and [datatime]<'2002-2-3'