select * from notic where convert(varchar(18),pb_date)='2009-4-26 11:29:47' 试试这吧,应该可以的
秒数一样好,毫秒数还可能不一样啊,两个时间还是不一定相等比较两个时间是不是同一天 select * from notic where datediff(d,pb_date,'2009-4-26 11:29:47')=0 比较两个时间是不是同一秒 select * from notic where datediff(s,pb_date,'2009-4-26 11:29:47')=0
select * from notic where datediff(s,pb_date,'2009-4-26 11:29:47')=0 这样查询就可以得到你要的结果了,其中s代表比较两个时间相差多少秒
select * from notic where CONVERT(varchar, pb_date, 120 )='2009-4-26 11:29:47'
select * from notic where cast(varchar(10),pb_date,120)='2009-4-26'试试
pb_date=‘2009-4-26 11:29:47’字符怎么看起来是全角的?
试试这吧,应该可以的
select * from notic where datediff(d,pb_date,'2009-4-26 11:29:47')=0
比较两个时间是不是同一秒
select * from notic where datediff(s,pb_date,'2009-4-26 11:29:47')=0
这样查询就可以得到你要的结果了,其中s代表比较两个时间相差多少秒