Delete From A Where D <> TnDelete From A Where Datediff(day, D, Tn) <> 0

解决方案 »

  1.   

    Delete A where D <> Tn  
    or
    Delete A where datediff(day,D,Tn) <> 0
    or
    Delte A where convert(char(10),D,120) <> convert(char(10),D,120)
    ...
      

  2.   

    delete A表 where month(d)<>month(Tn)
      

  3.   

    To all:
    1、注意是月份相等
    2、日期可能跨年
      

  4.   

    Delete A where datepart(m,d) <> datepart(m,Tn)
      

  5.   

    delete from A where convert(char(7),D,111)<>convert(char(7),Tn,111)
      

  6.   

    Delete A where datepart(m,d) <> datepart(m,Tn)
      

  7.   

    Delete A where datepart(m,D) <> Tn
      

  8.   

    delete from A表 
    where datepart(m,D)
    not in
    (
    select datepart(m,T1)
    union
    select datepart(m,T2)
    union
    ...
    select datepart(m,Tn)
    )
      

  9.   

    delete A表 where month(d) not in (month(1),month(2),....month(Tn))
      

  10.   

    delete A表 where datename(mm,Tn)<>d
      

  11.   

    to   myflok(阿棋)
    同意
      

  12.   

    我觉得 mjhnet(天涯沦落人) 的应该可以,我明天试一试!
      

  13.   

    Delete A where month(D) not in (month(@t1),month(@t2),month(@tn))
      

  14.   

    to  pengdali(大力 V2.0) :
    如果是不同年份的两个记录月份相同,这样能删除对应年的记录,保留不对应年份的记录吗?比如A中有一条2003-9-1的记录,我想删除的是与2002-9-1相同年月份的记录,而不删除2003-9-1记录?你的可以吗?
      

  15.   

    to pengdali(大力 V2.0):
    你的方法在query中可以删除所有数据,但是在存储过程中,只能删除最上面一条数据???
      

  16.   

    to pengdali(大力 V2.0):
    是我搞错了,忘了set ROWCOUNT 0
      

  17.   

    Delete A where convert(char(6),T,112) not in (convert(char(6),@t1,112),convert(char(6),@t2,112),convert(char(6),@tn,112))