[GRASS-user] db.execute where condition

Rich Shepard rshepard at appl-ecosys.com
Mon Mar 7 14:27:12 EST 2011


On Mon, 7 Mar 2011, Frans-Joost Boogert wrote:

> I removed the 'within' quotes and the command line now looks like this:
> echo 'UPDATE landuse_table SET FEATURE_ID=1 WHERE
> FEATURE=Grazing_land'|db.execute driver=dbf database=$database

Frans-Joost,

   You still don't have the correct syntax. Look at the examples on the
db.execute page:

Update attribute entries to new value based on SQL rule:

echo "UPDATE roads SET travelcost=5 WHERE cat=1" | db.execute

   Notice that the entire expression to be echoed is in double quotes. Other
examples on that page show the column values are in single quotes. Try:

echo "UPDATE landuse_table SET FEATURE_ID=1 WHERE FEATURE='Grazing_land'" | db.execute

after setting the driver and database name separately.

Rich



More information about the grass-user mailing list