Unable to successfully read sqlserver Date datatype [ODBC, DataFrames]

vtomar
Tue, 19 Oct 2021 22:22:02 +0000
New to Julia

i have a very simple query:

using ODBC, Dates, DataFrames

query = "select id, convert(date, ColumnName1) as CalendarDate from table1"
conn = DBInterface.connect(ODBC.Connection, "ConnectionString");
statement = DBInterface.prepare(conn, query);
df = DBInterface.execute(statement) |> DataFrame

The above code returns CalendarDate as type String? but the string values look like this:

"2000-01-1\0\0"

The date is being incorrectly read. I am not sure what the \0s are and how to fix this?

2 posts - 2 participants