I have been successfully using RODBC for a long time (years) to connect to
MS SQL Server from R.
This week I wanted to try using odbc but I am seeing some problems which
may be related to how I set up my driver and/or connection.
The dbWriteTable manual page gives as an example command:
dbWriteTable( pDB$con, "mtcars", mtcars[1:5,])
When I try this I get the following error
Error: <SQL> 'CREATE TABLE "mtcars" (
"row_names" varchar(255),
"mpg" FLOAT,
"cyl" FLOAT,
"disp" FLOAT,
"hp" FLOAT,
"drat" FLOAT,
"wt" FLOAT,
"qsec" FLOAT,
"vs" FLOAT,
"am" FLOAT,
"gear" FLOAT,
"carb" FLOAT
)
'
nanodbc/nanodbc.cpp:1587: 42000: [FreeTDS][SQL Server]Incorrect syntax
near 'mtcars'.
I believe that the complaint is related to the double quotes around
"mtcars" (and presumably the other double quotes in the command).
I tried searching to see if others have had this problem but I could not
find anything.
Thanks
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.