我想把数据库中下面这几个字段为空的删除,下了下面的代码,执行完数据库没有改变阿,是不是空不能用''''表示阿?谢谢!
ADOQuery1.Close;       
     ADOQuery1.SQL.Clear;
     s:='delete from a01 where callsign='''' and voy='''' and port='''' and MV='''' and date='''' and re=''''';
     ADOQuery1.SQL.Add(s);
     ADOQuery1.execsql;

解决方案 »

  1.   

    试试:
    s:='delete from a01 where callsign is null and ....'
      

  2.   

    我写完之后,由于字段比较多,delph报超长的错误,所不能超过255个字符,怎么解决阿?
    我用了
    s1:='callsign is null and voy is null....'
    s2:='re is null and ...'
    s:=s1+s2;
    ADOQuery1.SQL.Add(s);
         ADOQuery1.execsql;
    还是报超长的错误,该怎么解决阿?
      

  3.   

    一段一段加,不要连成一个str再加
    ADOQuery1.SQL.Add(s1);
    ADOQuery1.SQL.Add(s2);
      

  4.   

    ADOQuery1.Close;        //删除直接增加到库里的数据
         ADOQuery1.SQL.Clear;
    s1:='delete from a11t where carriercode is null and carriername is null';
    s2:=' blno is null and cntno is null and typesize is null and disport is null and temp is null and oh is null and ol is null and ow is null and imdg is null and commodity is null and re is null';     ADOQuery1.SQL.Add(s1);
         ADOQuery1.SQL.Add(s2);
         ADOQuery1.execsql;
    还是说超长阿
      

  5.   

    你的空是 "" 还是 null写在存储过程里,调用存储过程得了。