0

I have the following R code used to connect to a MS SQL Server.

My table and column names contains unicode characters. And they appear odd when written to the database from R.

library(odbc)
library(DBI)
conn <- DBI::dbConnect(odbc::odbc(), .connection_string = "driver=SQL Server;server=127.0.0.1;database=AdventureWorks;uid=xxx;pwd=abc;")    
DBI::dbWriteTable(conn, "TestTableÆØÅ", dataset)    
DBI::dbDisconnect(conn)

I've tried setting the CharacterSet and charset properties in the connection string but this is not helping.

How do i get R and DBI to write the correct tablenames and columns to the SQL Server.

My default R file encoding is UTF-8 and sessionInfo() lists Danish_Denmark.125

The actual data are written down fine with no encoding issues. Its the table and column names there is the issue.

wibeasley
  • 5,000
  • 3
  • 34
  • 62
CodeMonkey
  • 3,418
  • 4
  • 30
  • 53

0 Answers0