[R-sig-DB] binding variable in sqlQuery
Sean Davis
@d@v|@2 @end|ng |rom m@||@n|h@gov
Tue Dec 5 14:49:17 CET 2006
On Tuesday 05 December 2006 05:36, ggorjan.34155694 using bloglines.com wrote:
> Try paste() i.e.
>
> my_value = 10
> library(RODBC)
> inchannel <- odbcConnect("my_server",
> uid="samay")
> query <- paste("select item1, item2 from _my_table
>
> where item3 >= 10
> and dbid = ", my_value)
>
> sqlQuery(inchannel,
> query)
I've been using sprintf more recently; I find it makes the queries much easier
to read when there are multiple values that need to be inserted.
Sean
More information about the R-sig-DB
mailing list