When updating or adding a row in a database with a "blob/varbinary" column in sql server, an error is thrown.
This fails:
con <- DBI::dbConnect(odbc::odbc(),
driver = "ODBC Driver 17 for SQL Server",
server = db.keys[["server"]],
database = "BlobDB",
uid = db.keys[["uid"]],
pwd = db.keys[["pwd"]]
)
# table with blob_id (int) and blob (varbinary)
x <- con %>% tbl("table_with_blob")
y<- data.frame(blob_id=2, blob = blob::as_blob(base::serialize("test string in blob", NULL)))
rows_update(x, y, by = "blob_id", copy = TRUE, in_place = TRUE, unmatched = "ignore")
# gives: [Microsoft][ODBC Driver 17 for SQL Server]String data, right truncation
# same thing for rows_append
While it works with DBI:
y<- data.frame(blob = blob::as_blob(base::serialize("test string in blob", NULL)))
# this works
DBI::dbAppendTable(con, "table_with_blob", y)