select * from tabel1 where x='2001-12-28 10:10:10'

解决方案 »

  1.   

    应当是select * from tabel1 where x=TO_DATE('2001-12-28 10:10:10', 'YYYY-MM-DD HH24:Mi:Se')  
      

  2.   

    只要时间time不要date,如11:11:11,不要2001-12-26
      

  3.   

    sqlstr:='select * from table1 ';
    sqlstr:=sqlstr+'where x=:timepar1 ';
    query.sql.add(sqlstr);
    query.parambyname('timepar').value:=formatdatetime('yy-mm-dd',y);
    query.execsql;
      

  4.   

    100%完全正确的方法是:if Query1.Active then
      Query1.CLose;
    Query1.SQL.Clear;
    Query1.SQL.Add('select * from tabel1 where X=:paraX');
    Query1.ParamByName('paraX').AsDateTime := Y;
    Query1.Open;
      

  5.   

    如table1中有如下记录:
    record#     x
    1          2001-1-1 11:11:11
    2          2001-12-11 11:11:11
    3          2001-12-1 11;12;11
    4          2001-12-1 11:12:11
    5          2001-12-11 11:13:11
    如果输入11;11;11,则输出记录1和记录2的数据
      

  6.   

    if Query1.Active then
      Query1.CLose;
    Query1.SQL.Clear;
    Query1.SQL.Add('select * from tabel1');
    Query1.SQL.Add('where DATEPART(hour,x)=11');
    Query1.SQL.Add('and DATEPART(minute,x)=11');
    Query1.SQL.Add('and DATEPART(second,x)=11');
    Query1.Open;不正确不给加分!!!