[R] [RODBC] date attribute in sqlQuery

Abderrazzak MANY amany at messel.emse.fr
Tue Aug 12 11:41:27 CEST 2008


Hello R users,

I would like to use an integer and a date as attributes in sqlQuery,  
and these arguments
are defined in my function.

Here is my function:

GetReturn<-function(code,date)
{
channel<-odbcConnect("db","user1","password")

ssql<-paste("select * from TABLE Where PF_CODE =",code,"and PF_DATE=",date)

mydata<-sqlQuery(channel,ssql)

mydata
}

Actually, the channel is open but the query on the table did not work.
The command paste worked for the integer argument but not for the date.

Thank you for helping.

A.Many



More information about the R-help mailing list