Open
Description
#124 may be the same issue or related. I am getting an error trying to insert when a datetime2 field which has an explicit nil.
defmodule MinimalProof do
alias MyRecord
def proof_of_issue() do
bulk_inserts = [
%{
my_date: nil # utc_datetime, optional in the schema
}
]
try do
Repo.inse
5C07
rt_all(MyRecord, bulk_inserts)
rescue
err -> IO.puts("it fails in here because of #{inspect(err)}")
end
end
end
it fails in here because of %Tds.Error{message: nil, mssql: %{state: 3, number: 257, server_name: ".\\SQLEXPRESS", class: 16, msg_text: "Implicit conversion from data type varbinary to datetime2 is not allowed. Use the CONVERT function to run this query.", line_number: 1, proc_name: ""}}
I have a workaround now of dropping nil date fields from the inserts.
Environment and library versions
SQL Server 16
phoenix_ecto 4.6
ecto_sql 3.12
tds 2.3