Closed
Description
I was running into errors when trying to use copy_dm_to()
on a dm containing a table with a string field that could exceed 255 characters. Note that I am copying the dm to an MSSQL database.
The error was a SQL error reading: String or binary data would be truncated.
After some digging, I believe the issue stems from the line in build_copy_queries()
, which reads: tbl <- tbl_impl(ptype_dm, x)
It seems that it's trying to use the table with 0 rows to inform the column definitions, but this will assume VARCHAR(255) for any strings, even if that column contains a value of greater than 255 characters.
When I updated the line on my end to instead point at dm
instead of ptype_dm
to read tbl <- collect(tbl_impl(dm, x))
this seemed to fix the issue.