v.db.update

Langue: en

Autres versions - même langue

Version: 370629 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)

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 (varchar values have to be in single quotes, e.g. 'grass')
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.addcol 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.addcol 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)" rs

            where="z_value <> 'N/A'"

SEE ALSO

db.execute, v.db.addcol, 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: 2007-06-29 09:51:12 +0200 (Fri, 29 Jun 2007) $

Full index

© 2003-2008 GRASS Development Team