Board index » delphi » SQL Insert syntax problem

SQL Insert syntax problem

Anyone know how to use the SQL insert command to insert data into a
field that has a space in its name?

The following sql will *not* work on a Paradox table with BDE 5.0 :

insert into mytable
("my field with a space in its name")
values (123)

insert into mytable T
(T."my field with a space in its name")
values (123)

These SQL statements give "invalid token" errors.

Strangely, there is no problem on update SQl, as this allows the "T."
syntax.

Any ideas?

--
K M Payne

 

Re:SQL Insert syntax problem


I usually use the QBE Query in the Database Desktop and then hit the SQL
button as a place to start when I run into SQL that won't work on the
various databases I use.

Certainly the DBD does sometimes generate invalid SQL depending on the
database but it does come up with some intersting stuff.

I tried it on some Paradox tables with fields that have spaces and it (the
SQL) worked OK.

INSERT
INTO "Saledtl.db" ("Saledtl.db"."Sales Date", Store, Register,
"Saledtl.db"."CRT Number", Item)
VALUES ('01/01/1999', 1.0, 1.0, 100.0, 1.0)

As I said I use it as a place to start.  Hope this helps.

Carl

Quote
K M Payne wrote in message ...
>Anyone know how to use the SQL insert command to insert data into a
>field that has a space in its name?

>The following sql will *not* work on a Paradox table with BDE 5.0 :

>insert into mytable
>("my field with a space in its name")
>values (123)

>insert into mytable T
>(T."my field with a space in its name")
>values (123)

>These SQL statements give "invalid token" errors.

>Strangely, there is no problem on update SQl, as this allows the "T."
>syntax.

>Any ideas?

>--
>K M Payne

Re:SQL Insert syntax problem


Carl -

Thank you very much for your answer. I haven't tried it yet, but I'm
sure it'll solve my problem.

Best wishes

- Ken

In article <7i126c$sl...@autumn.news.rcn.net>, Carl J. Mosca
<cmo...@erols.com> writes

Quote

>INSERT
>INTO "Saledtl.db" ("Saledtl.db"."Sales Date", Store, Register,
>"Saledtl.db"."CRT Number", Item)
>VALUES ('01/01/1999', 1.0, 1.0, 100.0, 1.0)

--
K M Payne

Other Threads