On Tue, 21 Oct 2014 19:21:50 +0000
"Romero, Fernando" <[email protected]> wrote:

> Hola buenas tardes, tengo un tabla con la siguiente extructura
> 
>   Columna   |         Tipo          |                          Modificadores
> ------------+-----------------------+-----------------------------------------------------------------
> id         | integer               | not null valor por omision 
> nextval('trabajos_id_seq'::regclass)
> empresa    | character varying(30) |
> contacto   | character varying(30) |
> tarea      | character varying(60) |
> comentario | text                  |
> fecha      | date                  |
> valor      | character varying(30) |
> factura    | character varying(30) |
> indices:
>     "trabajos_pkey" PRIMARY KEY, btree (id)
... 
> cuando quiero cambiarle la definición me tira error:
> 
> dbtrabajos=#  ALTER TABLE "public"."trabajos" ALTER COLUMN "valor" TYPE 
> numeric(30);
> ERROR:  la columna 'valor' no puede convertirse automaticamente al tipo 
> numeric
> SUGERENCIA:  Especifique una expresion USING para llevar a cabo la conversion.
> 
> No encuentro como especificar la opción “USING”.

http://www.postgresql.org/docs/current/static/sql-altertable.html

Ejemplo: 

ALTER TABLE "public"."trabajos" 
      ALTER COLUMN "valor" TYPE numeric(30)
      USING TO_NUMBER(valor, '9999999999');

-- 
Alberto Cabello Sánchez
<[email protected]>

-
Enviado a la lista de correo pgsql-es-ayuda ([email protected])
Para cambiar tu suscripci�n:
http://www.postgresql.org/mailpref/pgsql-es-ayuda

Responder a