在R中限制从SQL导入的字符数

在R中限制从SQL导入的字符数,sql,r,Sql,R,我在R中使用sqlquery函数将DB与R连接起来 for (i in 1:length(Counter)){ if (Counter[i] %in% str_sub(dir(),1,29) == FALSE){ DT <- data.table(sqlQuery(con, paste0("select a.* from edp_data.sme_loan a where a.edcode IN (", print(paste0("

我在R中使用sqlquery函数将DB与R连接起来

for (i in 1:length(Counter)){
if (Counter[i] %in% str_sub(dir(),1,29) == FALSE){

DT <- data.table(sqlQuery(con, paste0("select a.* from edp_data.sme_loan a
                            where a.edcode IN (", print(paste0("\'",EDCode,"\'"), quote=FALSE),
                            ") and a.poolcutoffdate in (",print(paste0("\'",str_sub(PoolCutoffDate,1,4),"-",str_sub(PoolCutoffDate,5,6),"-",
                            str_sub(PoolCutoffDate,7,8),"\'"), quote=FALSE),")")))}}
实际上,在这个数据库中应该有更多的唯一ID。问题是as3的字符串比导入的字符串长得多

nchar(unique(DT$as3))
[1] 29 29
如何从该字符串中导入更多字符?理想情况下,我不想在select a.*中指定每个变量,只想确保它导入as3的完整字符串

感谢您的帮助

nchar(unique(DT$as3))
[1] 29 29