Skip to content

Help: sqlSave Error

2 messages · bruclee, Jeff Newmiller

#
I am using sqlSave to save my data into an existing table at MS SQL Server
database. Previously my code ran smoothly but all of a sudden it stopped
working. Here is my code:

sqlSave(con, highVol, "dbo.futuresHighVol", append=TRUE, rownames=FALSE)

Error: sqlSave(con, highVol, "jrgchis.dbo.futuresHighVol", append = TRUE,  : 
  42S01 2714 [Microsoft][ODBC SQL Server Driver][SQL Server]
'futuresHighVol' already exist
[RODBC] ERROR: Could not SQLExecDirect 'CREATE TABLE
jrgchis.dbo.futuresHighVol  ("TradeTime" varchar(255), "vol" float)'

Please Help!!!



--
View this message in context: http://r.789695.n4.nabble.com/Help-sqlSave-Error-tp4022523p4022523.html
Sent from the R help mailing list archive at Nabble.com.
#
The error seems clear enough to me... sqlSave is trying to create the table but it already exists.

Some possible directions you could take:

1) Do your work on a particular instance of the table within a single transaction and rollback at the end.
2) Delete the table before you run sqlSave.
3) Explicitly create the table once and keep it, deleting data before re-using it, and use the append option.
4) Include a column that distinguishes between different blocks of data and keep all of the data you add to it.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
bruclee <brouce33 at gmail.com> wrote: