search for: pktbl

Displaying 1 result from an estimated 1 matches for "pktbl".

Did you mean: pgtbl
2011 May 02
2
INSERT OR UPDATE
...y(RODBC) tbl <- data.frame( key1 = rep(1:3, each = 2), key2 = rep(LETTERS[1:2], 3), somevalue = rnorm(6) ) # Create table in database using the following SQL CREATE TABLE tbl ( key1 integer NOT NULL, key2 character varying(1) NOT NULL, somevalue double precision, CONSTRAINT pktbl PRIMARY KEY (key1, key2) ) # Continue in R pg <- odbcConnect("testdb") sqlSave(pg, tbl[1:2, ], append = TRUE, rownames = FALSE) sqlSave(pg, tbl[3, ], append = TRUE, rownames = FALSE) tbl[1, 3] <- 1 sqlUpdate(pg, tbl[1:4, ], index = c("key1", "key2")) # Fails #...