22,210
社区成员
发帖
与我相关
我的任务
分享
declare @i int
set @i=1
declare @s varchar(20)
select @s=select top 1 convert(varchar(20),'2010-10-1') from tb where TickNO=2
while @i<20
begin
select ascii(substring(@s,@i,1)) from tb where TickNO=2
set @i=@i+1
select @@version
select * from tb where [date]='2010-10-13 00:00:00.000'
select * from tb where [date]='2010-10-13'
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
Oct 14 2005 00:33:37
Copyright (c) 1988-2005 Microsoft Corporation
Express Edition on Windows NT 5.1 (Build 2600: Service Pack 3)
(1 行受影响)
id date
----------- -----------------------
1 2010-10-13 00:00:00.000
2 2010-10-13 00:00:00.000
3 2010-10-13 00:00:00.000
4 2010-10-13 00:00:00.000
5 2010-10-13 00:00:00.000
(5 行受影响)
id date
----------- -----------------------
1 2010-10-13 00:00:00.000
2 2010-10-13 00:00:00.000
3 2010-10-13 00:00:00.000
4 2010-10-13 00:00:00.000
5 2010-10-13 00:00:00.000
(5 行受影响)
没有问题。。
select * from tb where date = '2010-10-13 00:00:00.000'
select * from tb where convert(varchar(10),date,120) = '2010-10-13'
select * from tb where datediff(day,date, '2010-10-13') = 0