<分区>
我在 R
中有以下函数:
dbhandle <- odbcDriverConnect('driver={SQL Server};
server=myServer;database=myDB;
trusted_connection=true')
func <- function(x){
sqlQuery(dbhandle, 'select attr from myTable where cond = x')
}
我想知道如何将 x
参数传递给 cond
属性的 where
条件。比如我要计算func(10)
,那么查询一定是:
select attr from myTable where cond = 10