Hello,
I am trying to insert a lot of data into a table using windows R (2.3.1)
and a mysql database via RODBC.
First I read a file with read.csv and then form sql insert statements
for each row and execute the insert query one row at a time. See the
loop below.
This turns out to be very slow.
On Fri, 2006-10-13 at 09:09 -0400, Bill Szkotnicki wrote:
Hello,
I am trying to insert a lot of data into a table using windows R (2.3.1)
and a mysql database via RODBC.
First I read a file with read.csv and then form sql insert statements
for each row and execute the insert query one row
, a surgery of suppositions. ~M.J.Moroney
-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Bill Szkotnicki
Verzonden: vrijdag 13 oktober 2006 15:09
Aan: [EMAIL PROTECTED]
Onderwerp: [R] RODBC sqlQuery insert slow
Hello,
I am trying to insert a lot of data
To: [EMAIL PROTECTED]
Subject: [R] RODBC sqlQuery insert slow
Hello,
I am trying to insert a lot of data into a table using
windows R (2.3.1) and a mysql database via RODBC.
First I read a file with read.csv and then form sql insert
statements for each row and execute the insert query one row
I am trying to insert a lot of data into a table using windows R (2.3.1)
and a mysql database via RODBC.
First I read a file with read.csv and then form sql insert statements
for each row and execute the insert query one row at a time. See the
loop below.
This turns out to be very slow.
Can
Thanks for the help ... the sqlSave() function was the solution.
The lesson, which has been stated many times before, is to avoid loops
wherever possible!
Bill
# fast RODBC inserting
dat - cbind(as.character(strptime(ti[,2],%d/%m/%y %H:%M:%S
%p)),ti[,3:12])
# you need the as.character to make