[DUG] SQL Keywords - "date" field in dbase BDE sql

Brian Wrigley bswrigley at xtra.co.nz
Thu Jan 18 14:42:42 NZDT 2007


SQL KeywordsHi Eoin,

I've had to do that in the past with DBase files.

You need to refer to the field as (for example) "SupQuote.dbf"."Date"
(the quotes are part of the syntax).

eg (working code):

  sql.add('Insert into "SupQuote.dbf"');
  sql.add('(Job_No, Sup_code, "SupQuote.dbf"."Date",');
  sql.add('  Sup_Ref, Contact)');
  sql.add('Values (');
  sql.add(Ref_No + c + q + Supp_Code + qcq
    + FormatDateTime('mm"/"dd"/"yyyy', date) + qc);
  sql.add(q + Sup_Ref + qcq + getToken(S) + q);
  sql.add(')');


[ given:
Const q = '''';
  c = ',';
  qc = ''',';
  qcq = ''',''';
 ]


If you need to specify the alias as well as the filename I think the format is (from memory): ":aliasname:filename.ext"."fieldname"


Brian
  ----- Original Message ----- 
  From: Eion McIntosh (Christchurch) 
  To: delphi at ns3.123.co.nz 
  Sent: Thursday, January 18, 2007 12:58 PM
  Subject: [DUG] SQL Keywords


  Hi 

  We have on app using Dbase tables, created sometime ago, which we need to do a new query over one of the tables. I'm using the TQuery compenent but have struck a snag in that one of the fields we want to query is called DATE and the component does not like DATE because it classed as a keyword. 

  Is there anyway to change to query so we can query over the DATE field without having to rename it throughout the whol application?

  I know in SQL itself you can put squarebrackets around the fieldname, [DATE], to overcome this issue but the TQuery component doesn't like that either.

  Regards 
  Eion McIntosh 
  PPCS Ltd 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns3.123.co.nz/pipermail/delphi/attachments/20070118/d944d5e3/attachment.html


More information about the Delphi mailing list