Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General » Mysql »

Problema al Hacer Alter Table MySQL

Estas en el tema de Problema al Hacer Alter Table MySQL en el foro de Mysql en Foros del Web. Hola muy buenas, tengo una tabla en una Base de Datos y concretamente en un campo quiero hacer que se rellene con ceros a la ...
  #1 (permalink)  
Antiguo 15/04/2009, 03:50
 
Fecha de Ingreso: agosto-2007
Mensajes: 248
Antigüedad: 16 años, 7 meses
Puntos: 1
De acuerdo Problema al Hacer Alter Table MySQL

Hola muy buenas, tengo una tabla en una Base de Datos y concretamente en un campo quiero hacer que se rellene con ceros a la izquerda. Es decir al insertar un "82" quiero que me rellene con "00082". Al hacer el Alter Table me da un error en la consulta en MySQL. Alguna ayuda, gracias ¡¡¡


Código:
ALTER TABLE `puntosdeventa`.`t_puntos_venta` (MODIFY COLUMN `NRO_ESTACION` INTEGER UNSIGNED ZEROFILL NOT NULL DEFAULT NULL AUTO_INCREMENT)ENGINE = InnoDB;
Bye ¡¡
  #2 (permalink)  
Antiguo 15/04/2009, 03:58
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 1 mes
Puntos: 574
Respuesta: Problema al Hacer Alter Table MySQL

Código sql:
Ver original
  1. ALTER TABLE `puntosdeventa`.`t_puntos_venta`
  2. (
  3. MODIFY COLUMN `NRO_ESTACION` INTEGER UNSIGNED ZEROFILL
  4.                             NOT NULL DEFAULT NULL AUTO_INCREMENT
  5. )
  6. ENGINE = InnoDB;

Creo que el error viene de la cincongruencia

... NOT NULL DEFAULT NULL ....

Código sql:
Ver original
  1. ALTER TABLE `puntosdeventa`.`t_puntos_venta`
  2. (
  3. MODIFY COLUMN `NRO_ESTACION` INTEGER UNSIGNED ZEROFILL
  4.                             NOT NULL DEFAULT AUTO_INCREMENT
  5. )
  6. ENGINE = InnoDB;


Quim
  #3 (permalink)  
Antiguo 15/04/2009, 04:00
 
Fecha de Ingreso: agosto-2007
Mensajes: 248
Antigüedad: 16 años, 7 meses
Puntos: 1
Respuesta: Problema al Hacer Alter Table MySQL

Cierto, muchas gracias ¡¡¡
  #4 (permalink)  
Antiguo 15/04/2009, 04:12
Avatar de DBMark  
Fecha de Ingreso: mayo-2008
Ubicación: Oxford
Mensajes: 35
Antigüedad: 15 años, 11 meses
Puntos: 6
Respuesta: Problema al Hacer Alter Table MySQL

... NOT NULL DEFAULT NULL ....

Si, estaba al punto de preguntar sobre esto. En versiones antiguos de Mysql se podria poner esto; es decir un bug.

//bugs.mysql.com/bug.php?id=38421
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:36.