0

我将电子表格从 Excel 导出到数据库,它的某些字段名称中带有白色。我之前确实搜索过解决方案,但我找不到一种可行的方法来从列名中去除白色,仅针对列本身。我正在使用 R 向服务器发送查询。这是我的字段的样子:

[1] "DATA GERACAO"             "HORA_GERACAO"            
 [3] "ANO ELEICAO"              "NUM_TURNO"               
 [5] "DESCRICAO ELEICAO"        "SIGLA_UF"                
 [7] "SIGLA UE"                 "DESCRICAO_UE"            
 [9] "CODIGO CARGO"             "NUMERO_CANDIDATO"        
[11] "SEQUENCIAL CANDIDATO"     "NOME_CANDIDATO"          
[13] "NOME_URNA_CANDIDATO"      "DESCRICAO_CARGO"         
[15] "COD_SIT_CAND_SUPERIOR "   "DESC_SIT_CAND_SUPERIOR " 
[17] "COD_SITUACAO_CANDIDATURA" "DES_SITUACAO_CANDIDATURA"
[19] "COD_SIT_TOT_TURNO"        "DESC_SIT_TOT_TURNO"      
[21] "CODIGO_LEGENDA"           "SIGLA_PARTIDO"           
[23] "NOME_PARTIDO"             "SEQUENCIAL_LEGENDA "     
[25] "NOME_LEGENDA"             "COMPOSICAO_LEGENDA"      
[27] "TOTAL_VOTOS " 

我想删除空格,因为稍后我需要调用这些字段时可能会出现问题。我尝试了以下解决方案,并收到以下错误消息。有什么建议吗?

dbGetQuery(db, "UPDATE Table2 SET TOTAL_VOTOS = TRIM(Replace(Replace(Replace(TOTAL_VOTOS ,'\t',''),'\n',''),'\r',''))")

Error in sqliteSendQuery(con, statement, bind.data) : 
  error in statement: no such column: TOTAL_VOTOS
4

0 回答 0