GRASS logo

NAME

v.db.update - Allows to update a column in the attribute table connected to a vector map.

KEYWORDS

vector, database, attribute table

SYNOPSIS

v.db.update
v.db.update help
v.db.update map=string [layer=integer] column=string [value=string] [qcolumn=string] [where=string] [--verbose] [--quiet]

Parameters:

map=string
Vector map to edit the attribute table for
layer=integer
Layer to which the table to be changed is connected
Default: 1
column=string
Column to update
value=string
Value to update the column with, can be (combination of) other column(s)
qcolumn=string
Column to query
where=string
WHERE conditions for update, without 'where' keyword (e.g. cat=1 or col1/col2>1)

DESCRIPTION

v.db.update allows to assign a new value to a column in the attribute table connected to a given map. Alternatively, values can be copied from another column in the table.

NOTES

v.db.update is just a front-end to db.execute to allow easier usage. For complex SQL UPDATE statements, db.execute should be used.

EXAMPLES

Spearfish: adding new column, inserting selectively a specified value:
g.copy vect=fields,myfields
v.db.addcolumn myfields col="polynum integer"
v.db.update myfields col=polynum val=42 where="label='V. White#1'"
v.db.select myfields

Spearfish: adding new column, copying values from other table column with on the fly calculation:

g.copy vect=fields,myfields
v.db.addcolumn myfields col="polynum integer"
v.db.update myfields col=polynum qcol="cat*2"
v.db.select myfields

Type cast (type conversion) of strings to double precision (unsupported by DBF driver):

v.db.update mygeodetic_pts col=zval qcol="CAST(z_value AS double precision)" \
            where="z_value <> 'N/A'"

SEE ALSO

db.execute, v.db.addcolumn, v.db.addtable, v.db.connect, v.db.droptable, v.db.join, v.db.select
GRASS SQL interface

AUTHOR

Moritz Lennert (mlennert@club.worldonline.be)

Last changed: $Date: 2009-11-26 13:51:15 -0800 (Thu, 26 Nov 2009) $


Main index - vector index - Full index

© 2003-2011 GRASS Development Team