Skip to content

Error when using copy_dm_to() on a table containing a string field with more than 255 characters #2066

Closed
@tsilber21

Description

@tsilber21

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions