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)