SELECT
vP.BranchCD
,vP.ProductCD
,vP.CostPrice
,vP.OrderStartDate
FROM ABCD vP
WHERE
1=1
AND vP.modified>=2009/12/29------此字段是时间类型-----------------------------------------------------
时间类型输入错误,本以为会抱错,结果是把表中数据全部搜索出来这是为什么呢?
vP.BranchCD
,vP.ProductCD
,vP.CostPrice
,vP.OrderStartDate
FROM ABCD vP
WHERE
1=1
AND vP.modified>=2009/12/29------此字段是时间类型-----------------------------------------------------
时间类型输入错误,本以为会抱错,结果是把表中数据全部搜索出来这是为什么呢?
set @时间=2009/12/29
print @时间
create table tb(dt datetime)
insert into tb values(convert(varchar(10),getdate(),120))
insert into tb values(getdate())
insert into tb values(getdate())
insert into tb values(getdate())
insert into tb values(getdate())
insert into tb values(getdate())
goselect * from tb
/*
dt
------------------------------------------------------
2009-12-30 00:00:00.000
2009-12-30 22:08:21.187
2009-12-30 22:08:21.187
2009-12-30 22:08:21.187
2009-12-30 22:08:21.187
2009-12-30 22:08:21.187(所影响的行数为 6 行)
*/select * from tb where dt = 2009/12/30
/*
dt
------------------------------------------------------ (所影响的行数为 0 行)
*/select * from tb where dt = 2009-12-30
/*
dt
------------------------------------------------------ (所影响的行数为 0 行)
*/drop table tb