0

I was able to use DBI::dbWriteTable to write a table with a non-standard name [name@place:funny/pages], but I am unable to read it back in with DBI::dbReadTable.

When I try with:

dbReadTable(con, '[name@place:funny/pages]')

I see the error:

Error: nanodbc/nanodbc.cpp:1655: 00000: [Microsoft][ODBC Driver 17 for SQL Server][SQL Serv [Microsoft][ODBC Driver 17 for SQL Server][S L Serv 'SELECT * FROM "[name@place:funny/pages]"'

sessionInfo tells me I am using odbc_1.3.2 and DBI_1.1.1.

What am I doing wrong? Is there a way around the problem? I need to use that naming scheme to maintain compatibility with established processes.

I am able to read this table without issue from SQL with:

select * from [name@place:funny/pages]
wdkrnls
  • 4,548
  • 7
  • 36
  • 64
  • 1
    `name@place:/funny/pages` is not the same as `name@place:funny/pages`. – AlwaysLearning Jun 30 '21 at 22:38
  • That is true! However, that was a typo on my part in writing the question. It seems like the real problem is that nanodbc adds doublequotes. It doesn't do this with a direct SQL call. – wdkrnls Jul 01 '21 at 13:01
  • I figured out that I didn't need to include the brackets at all. – wdkrnls Jul 01 '21 at 13:35
  • I am absolutely curious in what context a SQL table name like that seems reasonable ... perhaps I've been encased too long in the fold of SQL naming conventions/restrictions. – r2evans Jul 02 '21 at 01:20

1 Answers1

0

The answer is to not include brackets at all.

wdkrnls
  • 4,548
  • 7
  • 36
  • 64