[R] Using RODBC to use SQL queries
Megan J Bellamy
bellammj at gov.ns.ca
Wed Jul 23 17:12:10 CEST 2008
Hello,
I am new to the RODBC package, but I have looked over the PDF as well as a few websites that go over the SQL language. I can connect to my database fine using
>channel<-odbcConnect("Oracle ODBC")
# then am prompted to enter my user id and password
After that I'd like to use the odbcQuery function and the SQL statement:
SELECT * FROM table_name WHERE SAMPLE_YEA LIKE "1965%"
According to the RODBC PDF, the odbcQuery command should accept any valid SQL statement. Is there something wrong with my syntax? I have tried a few things, like attaching the tables to the data frame but with no luck. According to the PDF, I should be able to use this argument:
>odbcQuery(channel, query, rows_at_time,=attr(channel, "rows_at_time"))
I have also tried to use arguments like:
>sqlColumns(channel, "SAMPLE_YEA")
but with no luck. Any help with this would be much appreciated! Thanks in advance,
Megan
More information about the R-help
mailing list