I am trying to query some data from a MSSQL database through HDBC and ODBC. I have however run into a problem when trying to query data from a table with unicode in the column names.
Consider the following MWE:
mwe :: IConnection conn => conn -> IO [[SqlValue]]
mwe conn =
do r <- quickQuery' conn
"SELECT [Højde] FROM [Table]"
[]
return r
When executing the above and passing it a connection object to the database i get the following error message:
*** Exception: SqlError {seState = "[\"42S22\",\"42000\"]", seNativeError = -1, seErrorMsg = "execute execute: [\"207: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid column name 'H\\195\\184jde'.\",\"8180: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Statement(s) could not be prepared.\"]"}
The relevant part most likely being that H\\195\\184jde
is not a valid column name.
My research has mostly led to results about unicode in the parameters to the query. I have tried to use bytestrings instead of normal strings, but since the argument for QuickQuery'
is a string that did not help.