2

How to make a select on a table containing special characters with presto on SQL Server.

For exemple : select * from myconnecter.[XXX, s_a_$item ledger entry];

My table name is [XXX, s_a_$item ledger entry] and I have this error: failed: line 1:28: mismatched input '.' expecting {, ',', 'ADD', 'AS', '

I already tried different solutions with \" or '' or removing brackets ... no idea...

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123
robino
  • 31
  • 1
  • 3
  • Presto uses the SQL standard identifier escape character, double quote. If you need a double quote in an identifier, you can escape a double quote with another double quote. – Dain Sundstrom Aug 05 '19 at 18:11

1 Answers1

2

Presto follows the SQL standard, which uses double quotes: SELECT * FROM myconnecter."[XXX, s_a_$item ledger entry]"

Piotr Findeisen
  • 19,480
  • 2
  • 52
  • 82
David Phillips
  • 10,723
  • 6
  • 41
  • 54
  • Your feedback is excellent ! what is strange it works but it seems I have an error on uppercase/lower case. The real name of the table is [XXXX, S_A_$Item Ledger Entry] and I have the error message : select * from navision.dbo."XXXX, S_A_$Item Ledger Entry"; Query 20190805_172741_00078_3c2fm failed: line 1:15: Table navision.dbo.sein, s_a_$item ledger entry does not exist select * from navision.dbo."Sein, S_A_$Item Ledger Entry" – robino Aug 05 '19 at 19:26
  • 1
    Try setting `case-insensitive-name-matching=true` for the connector configuration. – David Phillips Aug 07 '19 at 18:39