[R] sqlSave with underscores in table fieldname

Hoeven, Maarten van der Maarten.van.der.Hoeven at knmi.nl
Mon May 10 12:34:20 CEST 2004


Hi group,

I try to write a frame to a table (RODBC). I use
	colnames(temp6) <- c("ind_id","ser_id","period_id","year","calc","mean")
	sqlSave(channel, temp6, tablename = "series_indices_test",append= TRUE, rownames=FALSE, verbose = FALSE, test = FALSE, nastring = -999999, fast = FALSE)

This is giving me an error:
	Error in sqlSave(channel, temp6, tablename = "series_indices_test", append = TRUE,  : 
        	unable to append to table %sseries_indices_test

My table definition is:
ind_id smallint(3) 
ser_id smallint(4)
period_id tinyint(2)
year smallint(4)
calc mediumint(6)
mean mediumint(6)

This error is related to the underscores I use in the table. Because, when I change the table definition to (removing underscores):

indid smallint(3) 
serid smallint(4)
periodid tinyint(2)
year smallint(4)
calc mediumint(6)
mean mediumint(6)

and execute
	colnames(temp6) <- c("indid","serid","periodid","year","calc","mean")
	sqlSave(channel, temp6, tablename = "series_indices_test",append= TRUE, rownames=FALSE, verbose = FALSE, test = FALSE, nastring = -999999, fast = FALSE)


it goes well.

Not using the underscores is not really prefered, as this table with this underscores in the definition is used on a lot of places elsewhere. But if removing the underscores is the only solution, let me know as well.


Any clue?

Using R 1.9.0, RODBC-package 1.4.0 (underlying database MySQL 4.0.16-standard)

Thanks,
Maarten


+-------------------------------
| Maarten van der Hoeven
| KNMI, De Bilt
| +31-30-2206 402
| maarten.van.der.hoeven at knmi.nl
+-------------------------------
-------------------------------------------------------------- 

Zie ook/see also: http://www.knmi.nl/maildisclaimer.html




More information about the R-help mailing list