[R] wrong argument to TO_CHAR (RODBC)?

Nuno Prista nmprista at fc.ul.pt
Fri May 13 12:24:15 CEST 2011


Dear all,



I can't seem to run what seems (to me!) like a common SQL statement in RODBC:



data <- sqlQuery(a, 'SELECT TO_CHAR (DB1.DATE, 'yyyy') "year" FROM DB1')



In contrast,



data <- sqlQuery(a, 'SELECT TO_CHAR(DB1.DT_INICIO) "year" FROM DB1')



works but it does not come up as I want it to (i.e., in "year" format).



Can you tell me what I am doing wrong? I figure it has something to do with the '.


Thank you for your help,

Nuno

ps. In case you haven't noticed already I am a newbie in everything related to databases...



More information about the R-help mailing list