7

I have a paradox table from a legacy system I need to run a single query on. The field names have spaces in them - i.e. "Street 1". When I try and formulate a query in delphi for only the "Street 1" field, I get an error - Invalid use of keyword. Token: 1, Line Number: 1

Delphi V7 - object pascal, standard Tquery object name query1.

4 Answers4

9

You need to prefix the string with the table name in the query.

For example: field name is 'Street 1', table is called customers the select is:

SELECT customers."Street 1" FROM customers WHERE ...
Anya Shenanigans
  • 91,618
  • 3
  • 107
  • 122
2

You normally need to quote the field name in this case. For example:

select * from t1 where "street 1" = 'test';

I tried this on a paradox 7 table and it worked. If that doesn't help, can you post the query you are trying to use? It would be easier to help with that info.

Jeremy Mullin
  • 4,170
  • 4
  • 36
  • 54
0

I only need the street information from the address details held in the customer table. I can get it to work fine if I do a SELECT * FROM customers, however this is a very large table and returns numerous results. If I do SELECT "Street 1" FROM customers, the output is "Street 1" in every record returned - i.e. it does not return the actual data. It must be something to do with the use of "

Thanks for your help

Joe

-1

I think you must use [ and ] instead of ":

SELECT customers.[Street 1] FROM customers WHERE ...
Birger
  • 4,343
  • 21
  • 35