当前位置: 代码迷 >> Sql Server >> SQL的删除元组有关问题
  详细解决方案

SQL的删除元组有关问题

热度:65   发布时间:2016-04-27 15:27:39.0
SQL的删除元组问题
我用SQL2000的时候,建了两个同学数据有birthday是1986-3-21和1987-3-21,用
delete 
from pupil
where birthday<1987-3-21

随便用<或>,都会把数据全删了

------解决方案--------------------
SQL code
create table t(birth datetime)insert into t select '1986-3-21'insert into t select '1987-3-21'select * from tdelete from twhere birth<'1987-3-21'--(1行受影响)select * from tinsert into t select '1986-3-21'delete from twhere birth>'1987-3-21'--(0行受影响)select * from tdelete from twhere birth>1987-3-21--(2行受影响)select * from tgodrop table t
  相关解决方案