I have a variable in R that I would like to pass to a database. I could use paste
like many suggest when reading Google results, but that is unsafe because of SQL injection vulnerabilities. I'd rather prefer something like this:
x <- 42
sqlQuery(db, 'SELECT Id, Name FROM People WHERE Age > ?;', bind=c(x))
Is it possible to use parameterized queries with RODBC? If not, is there an alternative library that supports them?
I'm using SQL Server, RODBC 1.3-6 and R 3.0.0.
RODBCext
package – Singer