title: Convert SQL server query to Delphi syntax
body: <p>This is the original SQL server query which works:</p>
  
  <pre><code>use HIS
  
  SELECT
  room_type,rate_start_date,rate_end_date,rate
  , DATEDIFF(DAY,case when rate_end_date &lt; '2011.08.21'
  then '2011.08.19'
  else rate_start_date
  end,
  case when rate_start_date &gt; '2011.08.19'
  then '2011.08.21'
  else rate_end_date
  end
  ) AS days FROM room_rates
  WHERE room_type = 'DBLMS' AND rate_start_date &lt;= '2011.08.21'
  AND rate_end_date &gt; '2011.08.19'
  </code></pre>
  
  <p>I converted it to Delphi SQL :</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);
  begin
  uniQuery1.Close;
  uniQuery1.SQL.Clear;
  uniQuery1.SQL.Add('SELECT room_type,rate_start_date,rate_end_date,rate,');
  uniQuery1.SQL.Add('DATEDIFF(DAY,case when rate_end_date &lt; 2011.08.21 then 2011.08.19 else rate_start_date end,');
  uniQuery1.SQL.Add('case when rate_start_date &gt; 2011.08.19');
  uniQuery1.SQL.Add('then 2011.08.21 else rate_end_date end) AS days FROM room_rates');
  uniQuery1.SQL.Add('WHERE room_type = DBLMS AND rate_start_date &lt;= 2011.08.21');
  uniQuery1.SQL.Add('AND rate_end_date &gt; 2011.08.19');
  uniQuery1.Open;
  end;
  </code></pre>
  
  <p>However I am getting 'Invalid column NAME 'DBLMS''</p>
  
  <p>What am I missing here ? DBLMS is not a column.</p>