[R] Saving only few columns to database - RODBC doesnt work

Prabhat Dalmia prabhatdalmia at gmail.com
Fri Dec 26 21:38:38 CET 2014


Hi,

 

I want to save only few columns to a table in database from the data.frame
in R. My table has more columns than there are columns in my data.frame
object, so I want that all the columns which are not specified should insert
as nulls. I already have data in this table, and I would like to append more
data from this data frame.

 

If I use sqlSave() function in RODBC, this throws an error saying that data
is missing. There is no way for me to specify specific columns that I want
to save to database. There is a colnames parameter to this function, but
that is used only if I want to save the column names from the dataframe as
the first row in my table. 

 

This seems like a very simple functionality which I am not sure why sqlSave
doesnt provide. Is there any other way I could save these specific columns
to an existing table in my database ?

 

Thanks

pkd

 


	[[alternative HTML version deleted]]



More information about the R-help mailing list