我也在Sqlserver表中将所有varchar都设置为max,但这没有帮助。
diag_test <- diag[1:1025]
system.time({
DBI::dbWriteTable(con, "urban_prodbi_diag", diag_test, append = TRUE)
})
Error in result_insert_dataframe(rs@ptr, values) :
nanodbc/nanodbc.cpp:1587: HY000: The incoming tabular data stream (TDS)
remote procedure call (RPC) protocol stream is incorrect. Parameter 5
(""): The supplied length is not valid for data type nvarchar(max).
Check the source data for invalid lengths. An example of an invalid
length is data of nchar type with an odd length in bytes., Timing
stopped at: 0.049 0.002 0.135
它可以处理更少的行。
一些子集示例:
diag_test <- diagcopy[1:1024]
system.time({
DBI::dbWriteTable(con, "urban_prodbi_diag", diag_test, append = TRUE)
})
user system elapsed
0.042 0.000 0.109
diag_test <- diagcopy[1000:1025]
system.time({
odbc::dbWriteTable(con, "urban_prodbi_diag", diag_test, append = TRUE)
})
user system elapsed
0.014 0.000 0.074
在同一表模式和数据框上,插入未通过RODBC包给出任何错误。