替换SQLite数据库字段中的空格

时间:2015-07-20 03:24:52

标签: sqlite rsqlite

我将一个电子表格从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

0 个答案:

没有答案