Hi I am using R to save a data frame into a DB2 SQL table. I seem to be able to create the table skeleton, but not append the data to the table -
>df <- read.csv("dat.csv")
where dat.csv is a csv with no headers, just raw data in two columns
then i create the table:
>sqlQuery(channel, "create table sqltable
(
col1 int,
col2 float
)"
(
where I confirm the table is created by being able to select the empty table "sqltable" on the database
so now I need to add the data from "dat.csv" into "sqltable" by doing:
>sqlSave(channel, df, "sqltable", verbose=T, fast=T, append=T)
no: 1 rownames 1/***/no: 2 col1 31105/***/no: 3 col2 0.001/***/
no: 2 rownames 1/***/no: 2 col1 31106/***/no: 3 col2 0.023/***/
no: 3 rownames 1/***/no: 2 col1 31107/***/no: 3 col2 1.456/***/
no: 4 rownames 1/***/no: 2 col1 31108/***/no: 3 col2 0.001/***/
no: 5 rownames 1/***/no: 2 col1 31109/***/no: 3 col2 2.102/***/
all seems good until I do:
>sqlQuery(channel,"select * from sqltable")
[1] COL1 COL2
<0 rows> or 0-length row.names
the sqlSave command clearly picks up the data from dat.csv, so why is it not added to the table? what am I doing wrong?