nedich / txquery

Automatically exported from code.google.com/p/txquery
Other
2 stars 2 forks source link

dash or hyphen in field name not working #47

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have the following SQL that is getting hung up on a field that contains a 
dash in its name.

SELECT TableMain.Holw-serm-ID FROM TableImport INNER JOIN TableMain ON 
TableImport.[Holw-serm-ID]=TableMain.[Holw-serm-ID] WHERE 
TableMain.do_not_update IS NULL

I have tried putting the field quoted in [, ", and ` but makes no difference.

I get an ExQueryError with 'Field serm was not found'.

It seems the field name Holw-serm-ID is getting broken into TableMain.Holw, 
serm and ID.

What version of the product are you using? On what operating system?
3.0.1

Original issue reported on code.google.com by bdwil...@gmail.com on 13 Aug 2013 at 8:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I take it back, test code seems to be working correct.

Tried this in the TTest_Join.Test_EmptyKeyJoin_InnerJoin()

...
    with FQuery.SQL do begin
      Clear;
      Add('SELECT A.[Test-1], B.ItemCode');
      Add(  'FROM D1 A INNER JOIN D2 B ON (A.[Test-1]=B.[Test-2])');
    end;

Without the square brackets it gets a parse error, with them it seems to work 
correctly...will need to test some more.

Original comment by bdwil...@gmail.com on 14 Aug 2013 at 6:09

GoogleCodeExporter commented 9 years ago
My fault the hyphen with square brackets works correctly.  Issue was me missing 
the first SELECT id.

Solved.

Original comment by bdwil...@gmail.com on 14 Aug 2013 at 8:40