sql.update {RPgSQL}R Documentation

Update data in a column of a PostgreSQL table

Description

sql.update allows a database table to modified in place.

Usage

sql.update(table, column, value, condition)

Arguments

table A character string with the table name
column The column to be modified
value Data value to insert from
condition An optional condition to limit the rows modified

Author(s)

Adam M. Kornick

See Also

db.write.table,sql.insert, sql.select

Examples

if (db.connection.open()) {
  data(airquality)
  rpgsql.test.data <- airquality[1:5,]
  rm(airquality)
  db.write.table(rpgsql.test.data, no.clobber=F)
  db.read.table('rpgsql.test.data')
  # remove ozone observations where temperature is
  # greater than 70 
  sql.update('rpgsql.test.data', "Ozone", 0, "\"Temp\" >70")
  # note that quotes were embedded around case sensitive variables
  db.read.table('rpgsql.test.data')
  db.rm('rpgsql.test.data', ask=F)
}