[GRASS-user] Trying to rename a column

List:

Ultimately what I am trying to do is to make a varchar(5) field be a varchar(8) field — but I don't see how to do this directly. So, I thought if I created a new varchar(8) column, copied the values of the varchar(5) column into it (This all worked fine); then, renamed the varchar(5) column to 'foo' (which also worked), then I could rename the varchar(8) column to what the column name was for the original varchar(5) column — this does NOT work. Also, I would like to delete the 'foo' column, but I don't see how to do this.

Any suggestions?

Thanks,
Tom

--
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL: thomas.adams@noaa.gov

VOICE: 937-383-0528
FAX: 937-383-0033

Quick trick to try then is to open the dbf with OpenOffice you'll see the column specs is the 1st line with the column name. Just change the 5 to an 8. Or do the copy method you mentioned.

I've never seen another way to easily do it. You should think about changing to sqlite though, I was under this impression that it was the default for 6.3

Alex

Thomas.Adams@noaa.gov wrote:

Alex,

dbf; just the default for a generic vector file. I should have added more detail, such as that I am using GRASS 6.3 on Linux.

Thanks,
Tom

----- Original Message -----
From: Alex Mandel <tech_dev@wildintellect.com>
Date: Wednesday, August 13, 2008 10:55 pm
Subject: Re: [GRASS-user] Trying to rename a column

Thomas Adams wrote:

List:

Ultimately what I am trying to do is to make a varchar(5) field

be a

varchar(8) field — but I don't see how to do this directly. So, I thought if I created a new varchar(8) column, copied the values

of the

varchar(5) column into it (This all worked fine); then, renamed

the

varchar(5) column to 'foo' (which also worked), then I could

rename the

varchar(8) column to what the column name was for the original varchar(5) column — this does NOT work. Also, I would like to

delete the

'foo' column, but I don't see how to do this.

Any suggestions?

Thanks,
Tom

What's the data backend you're using? dbf, sqlite, postgis?

Alex

Thomas Adams pisze:

Ultimately what I am trying to do is to make a varchar(5) field be a varchar(8) field — but I don't see how to do this directly. So, I thought if I created a new varchar(8) column, copied the values of the varchar(5) column into it (This all worked fine); then, renamed the varchar(5) column to 'foo' (which also worked), then I could rename the varchar(8) column to what the column name was for the original varchar(5) column — this does NOT work.

Paste the exact command with an error message, v.info -c of the vector
map for which the command fails, your GRASS version and platform.

Also, I would like to delete the 'foo' column, but I don't see how to do this.

v.db.dropcol (it's been available since GRASS 6.3). If you don't have
it you can just fetch it from GRASS SVN [1], put somewhere on your
executable path and call it from GRASS, or use such a command:

echo "ALTER TABLE $table DROP COLUMN $col" | db.execute

[1]http://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/scripts

Maciek

--
Maciej Sieczka
www.sieczka.org