Board index » delphi » Problem with ALTER TABLE with spaces in field name

Problem with ALTER TABLE with spaces in field name

Hello All,

I want to add a field to a paradox table using TQuery and "ALTER TABLE" .
When the field (stored in argFieldName) has a space or single quote in the
name I get an "Invalid use of keyword" error even when I enclose the field
name in double quotes and "double single quotes".  Below is the code.

      qryAddField.SQL.Add ('ALTER TABLE "STOCK" ADD "' + FieldName + '"
NUMERIC');
      qryAddField.ExecSQL;

Any suggestions appreciated.
Paul Andonov.

 

Re:Problem with ALTER TABLE with spaces in field name


Quote
>I want to add a field to a paradox table using TQuery and "ALTER TABLE" .
>When the field (stored in argFieldName) has a space or single quote in the
>name I get an "Invalid use of keyword" error even when I enclose the field
>name in double quotes and "double single quotes".  Below is the code.

put it in this form.

ALTER TABLE "stock" ADD "Stock.db"."Field space"
NUMERIC
--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Other Threads