[postgis-users] Help: How do I change data type to character to numeric?
Roger André
randre at gmail.com
Sat Mar 28 12:47:21 PDT 2009
Hi Zia,
If it is at all possible, I would suggest that you use the shp2pgsql utility
to create an SQL load file from your .dbf files. The after verifying that
the SQL insert statements are correct, you can load the file into your DB.
Assuming you have a dbf file named "test.dbf", the workflow would look
something like this:
1. shp2pgsql -D test new_table_name db_name > test.sql
test: shape (.shp) or index files (.shx) can not be opened, will just import
attribute data.
2. View/edit insert statements in test.sql:
BEGIN;
CREATE TABLE "test" (gid serial PRIMARY KEY,
"name" varchar(100));
COPY "test" ("name") FROM stdin;
Papua New Guinea
\.
END;
3. Load data into DB using psql utility.
psql -d db_name -f test.sql
Roger
--
On Sat, Mar 28, 2009 at 7:19 AM, Marc Jansen <jansen.marc at gmx.de> wrote:
> Hey Zia,
>
> hope this helps:
>
> Try to chhange the columns data-type (Be sure to have a backup):
>
> ALTER TABLE table_name ALTER COLUMN column_name TYPE new_type
>
> see e.g.: http://www.postgresql.org/docs/8.0/static/sql-altertable.html
>
> If you are experiencing problems, the USING- Part in that documentation
> might be of interest.
>
> Regards,
>
> Marc
>
>
> Zia Ahmed schrieb:
>
> I am new in postgis. I ogr2ogr to import my dbase file to my data base.
>> After importation, data type of some of the column has changed to numeric to
>> character . How do I change data type to character to numeric again in
>> pgAdminIII environment?
>>
>> Thanks
>>
>> Zia
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090328/ee50bccd/attachment.html>
More information about the postgis-users
mailing list