[GRASS-user] changing collumn type on vector map

Moritz Lennert mlennert at club.worldonline.be
Thu Jul 2 13:04:28 EDT 2009

On 02/07/09 18:52, Milton Cezar Ribeiro wrote:
> Dear all,
> I just imported a shapefile on GRASS, and I need to convert several 
> fields from CHAR to numeric (double precision) - at my own risk, of course.
> Can I do it on grass, or I need to redo the thinks on arcgis ?!

Depends on your database backend. In PostgreSQL (and perhaps SQLite), 
you could do something like this:

echo "alter table XYZ alter column ABC type numeric" | db.execute

I don't think anything like this would be possible in dbf...

You could also try a combination of v.db.addcol + v.db.update to create 
new numeric columns and set the value of these columns to the value of 
the varchar column.


More information about the grass-user mailing list