[R] sqlSave
Yi-Xiong Zhou
yixiong_us at yahoo.com
Mon Feb 20 03:05:10 CET 2006
Hi,
I am having trouble to write/create a table, which has
a date field. I want to create a stock price table,
which has fields of ticker, date, price. First, I
created such a table in Microsoft Access with a few
rows inputs. Using sqlQuery, I found that the date
field was retrieved as POSIXct value. Then I made a
data.frame with POSIXct as the data type for dates.
However, I received the following errors when I was
executing the sqlSave:
> price = data.frame(ticker=rep("FMDEX",5))
> price$date=c(as.POSIXct("2003-1-1"),
as.POSIXct("2003-1-2"), as.POSIXct("2003-1-3"),
as.POSIXct("2003-1-4"), as.POSIXct("2003-1-5"))
> price$price=1:5
> price
ticker date price
1 FMDEX 2003-01-01 1
2 FMDEX 2003-01-02 2
3 FMDEX 2003-01-03 3
4 FMDEX 2003-01-04 4
5 FMDEX 2003-01-05 5
> sqlSave(h, price, rownames=F)
Error in sqlSave(h, price, rownames = F) :
[RODBC] ERROR: Could not SQLExecDirect
37000 -3553 [Microsoft][ODBC Microsoft Access Driver]
Syntax error in field definition.
I am using R2.2.1 with RODBC library, on a Dell P5
computer with winXP Pro and office 2003.
Thanks for your helps.
Sean
More information about the R-help
mailing list