title: How to compare Firebird TimeStamp and Delphi DateTime?
body: <p>I have the following script that never retrieve any data since TimeStamp data type in Firebird/Interbase is not DateTime (*)</p>
  
  <p>How should i fix it ?? TX. </p>
  
  <pre><code> with DMApp.qryValidPeriod_ do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select P.* from PERIOD P, FISCAL_YR F');    
      SQL.Add('where');
      SQL.Add('P.FISCAL_YR_ID = F.FISCAL_YR_ID and');     
      SQL.Add('F.ENTITY_DB_ID = :PRIMARY_DB_ID and');     
      SQL.Add('F.FISCAL_YR_ID = :CURR_FY_ID and');        
      SQL.Add(':pTranDate BETWEEN P.BEG_PERIOD and P.END_PERIOD');
  
      ParamByName('pTranDate').AsDateTime :=  sBATCH_DATE; 
  </code></pre>
  
  <p>// BEG_PERIOD and END_PERIOD are TimeStamp data type such as '2010-11-09 12:00' 
  // parameter return data type such as '2010-11-09'</p>
  
  <hr>
  
  <p>(*) A timestamp is a column datatype available in Firebird/Interbase/SQL Server... that helps to ensure data integrity. Timestamps are automatically updated every time a row containing a timestamp column is inserted or updated. Values in timestamp columns are not datetime data, but binary(8) varbinary(8) data. The timestamp datatype has no relation to the system time, it is simply a monotonically increasing counter whose values will always be unique within a database (making it basically a unique random number.)</p>