Skip to content
Back to formatted view

Raw Message

Message-ID: <264855a00811111624p1ea9caa0i32153f559b55a761@mail.gmail.com>
Date: 2008-11-12T00:24:14Z
From: Sean Davis
Subject: Problems with sqlSave
In-Reply-To: <3c57fdf0811111506y4c28ad09p367e92182050f9db@mail.gmail.com>

On Tue, Nov 11, 2008 at 6:06 PM, Grey Moran <grey.moran at gmail.com> wrote:

> Hello,
> I am trying to load data into SQL Server as follows (example
> simplified for discussion purposes). The returned error complains of a
> non existent table, which I can nevertheless "see":
>
> >channel <- odbcConnect("MktRisk")
> >createTable.q <- "CREATE TABLE dbo.Arrests (State CHAR(20) NOT NULL,
> MURDER DECIMAL(6,3) NOT NULL, ASSAULT INTEGER NOT NULL, URBANPOP INTEGER NOT
> NULL, RAPE DECIMAL(6,3));"
> >sqlQuery(channel, createTable.q);
> character(0)
> > sqlTables(channel)
>  TABLE_CAT TABLE_SCHEM             TABLE_NAME   TABLE_TYPE REMARKS
> .................
> 19   MktRisk         dbo               sysusers SYSTEM TABLE    <NA>
> 20   MktRisk         dbo                Arrests        TABLE    <NA>
> ..................
>
> > sqlSave(channel, dat=USArrests, tablename=Arrests, rownames = "state",
> addPK=TRUE)
> Error in sqlSave(channel, dat = USArrests, tablename = Arrests,
> rownames = "state",  :   object "Arrests" not found


You need quotes around "Arrests", I think.

Sean



>
>
> in the real case (more complex and hard to show here), I get this error:
> Error in sqlSave(channel, dat = the.bridge.df, tablename = someTable,
> :   unable to append to table 'US15Aug2008BridgeTable'
>
> As far as I can tell, the tables I create are of the appropriate kind
> - any ideas what might be the problem?
>
> Thank you,
>
> Grey
>
> _______________________________________________
> R-sig-DB mailing list -- R Special Interest Group
> R-sig-DB at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-db
>

	[[alternative HTML version deleted]]