[Rd] bug in sqlSave with fast=F option (PR#9429)

From: <paul.macmanus_at_gmail.com>
Date: Fri 22 Dec 2006 - 18:38:16 GMT

Full_Name: Paul MacManus
Version: 2.3.0
OS: Windows XP
Submission from: (NULL) (

See also R-help thread for October 18, 2006

Create a dataframe and save it to a database table "test" as follows:

df <- data.frame(T=1, S=10)
sqlSave(channel, df, "test", rownames=F)

The table now looks like

1 10

If I create another dataframe and save as follows

df <- data.frame(S=20, T=2)
sqlSave(channel, df, "test", rownames=F, append=T)

Then table "test" now looks like

1 10
2 20

The important point is that although S was the first column of df, sqlSave checked the column names and matched the corresponding columns of df and table "test".

However, if I now create another dataframe and save it using the fast=F option as follows

df <- data.frame(S=30, T=3)
sqlSave(channel, df, "test", rownames=F, append=T, fast=F)

the table test now looks like

1 10
2 20
30 3

In other words, sqlSave didn't check column names, it simply mapped column 1 to column 1 and column 2 to column 2.

I'm using R 2.3.0 and package RODBC 1.1-7 on Windows XP with MS SQL Server

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun Dec 24 01:05:50 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 23 Dec 2006 - 16:31:03 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.