<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>GRASS GIS: v.db.update</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="grassdocs.css" type="text/css"> </head> <body bgcolor="white"> <img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade> <h2>NAME</h2> <em><b>v.db.update</b></em> - Allows to update a column in the attribute table connected to a vector map. <h2>KEYWORDS</h2> vector, database, attribute table <h2>SYNOPSIS</h2> <b>v.db.update</b><br> <b>v.db.update help</b><br> <b>v.db.update</b> <b>map</b>=<em>string</em> [<b>layer</b>=<em>integer</em>] <b>column</b>=<em>string</em> [<b>value</b>=<em>string</em>] [<b>qcolumn</b>=<em>string</em>] [<b>where</b>=<em>string</em>] [--<b>verbose</b>] [--<b>quiet</b>] <h3>Parameters:</h3> <DL> <DT><b>map</b>=<em>string</em></DT> <DD>Vector map to edit the attribute table for</DD> <DT><b>layer</b>=<em>integer</em></DT> <DD>Layer to which the table to be changed is connected</DD> <DD>Default: <em>1</em></DD> <DT><b>column</b>=<em>string</em></DT> <DD>Column to update</DD> <DT><b>value</b>=<em>string</em></DT> <DD>Value to update the column with (varchar values have to be in single quotes, e.g. 'grass')</DD> <DT><b>qcolumn</b>=<em>string</em></DT> <DD>Column to query</DD> <DT><b>where</b>=<em>string</em></DT> <DD>WHERE conditions for update, without 'where' keyword (e.g. cat=1 or col1/col2>1)</DD> </DL> <h2>DESCRIPTION</h2> <em>v.db.update</em> 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. <h2>NOTES</h2> <em>v.db.update</em> is just a front-end to <em>db.execute</em> to allow easier usage. For complex SQL UPDATE statements, <em>db.execute</em> should be used. <h2>EXAMPLES</h2> Spearfish: adding new column, inserting selectively a specified value: <div class="code"><pre> 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 </pre></div> <p> Spearfish: adding new column, copying values from other table column with on the fly calculation: <div class="code"><pre> 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 </pre></div> <p> Type cast (type conversion) of strings to double precision (unsupported by DBF driver): <div class="code"><pre> v.db.update mygeodetic_pts col=zval qcol="CAST(z_value AS double precision)" \ where="z_value <> 'N/A'" </pre></div> <h2>SEE ALSO</h2> <em><a HREF="db.execute.html">db.execute</a></em>, <em><a HREF="v.db.addcol.html">v.db.addcol</a></em>, <em><a HREF="v.db.addtable.html">v.db.addtable</a></em>, <em><a HREF="v.db.connect.html">v.db.connect</a></em>, <em><a HREF="v.db.droptable.html">v.db.droptable</a></em>, <em><a HREF="v.db.join.html">v.db.join</a></em>, <em><a HREF="v.db.select.html">v.db.select</a></em><br> <em><a href="sql.html">GRASS SQL interface</a></em> <h2>AUTHOR</h2> Moritz Lennert (mlennert@club.worldonline.be) <p><i>Last changed: $Date: 2007-06-29 09:51:12 +0200 (Fri, 29 Jun 2007) $</i></p> <HR> <P><a href="index.html">Main index</a> - <a href="vector.html">vector index</a> - <a href="full_index.html">Full index</a></P> <P>© 2003-2008 <a href="http://grass.osgeo.org">GRASS Development Team</a></p> </body> </html>