variables inside an Rdi-select statement?!
hi, use paste() to build your query-string.
Stephan Holl wrote:
Dear R-users,
I would like to use an environment variable inside an SELECT-statement
from R to a postgres-db, but it will not work and so I need some advice
from you.
<code>
ezg <- Sys.getenv("EZG")
connect <- dbConnect.PgSQL(host="localhost", user="username",
dbname="dbname")
query <- dbSendQuery(connect, "SELECT ezg.s FROM ezg WHERE
ezg.s!='12'")
</code>
the error is, that SELECT searches for the relation ezg, but it should
use value stored in ezg.
Any suggestions?
thanks in advance
stephan
--
Linux: the operating system with a CLUE...
Command Line User Environment.
--------------------------------------
Stephan Holl
GnuPG Key-ID: 11946A09
ICQ# 117277975
--------------------------------------
------------------------------------------------------------------------
Part 1.2Type: application/pgp-signature
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._