Question

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.

Was it helpful?

Solution

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 ...

OTHER TIPS

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.

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

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

SELECT customers.[Street 1] FROM customers WHERE ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top