Pedro's blog: db2, mysql, php, linux and performance


DB2 Ignoring Generated always restriction on loading
05/12/2009, 22:07
Filed under: DB2 | Tags:

A little trick:

CREATE TABLE “THEPROFILE”.”ROL”  (
“ROL_ID” INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (
START WITH +4
INCREMENT BY +1
MINVALUE +0
MAXVALUE +2147483647
NO CYCLE
NO CACHE
NO ORDER ) ,
“ROL_NOMBRE” VARCHAR(50) NOT NULL ,
“ROL_DESCRIPCION” VARCHAR(255) NOT NULL )
IN “USERSPACE1” ;

If you want to load a new row and avoid the GENERATED ALWAYS AS IDENTITY then:

db2 “load from ‘rol.sql’ of del modified by identityoverride insert into db2admin.rol”

We know there are 4 rows on rol.sql.

Be careful with the state of the table space after running the load, maybe you’ll need this command:

db2 “SET INTEGRITY FOR THEPROFILE.ROL IMMEDIATE CHECKED”

Enjoy!




No Comments so far
Leave a comment



Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



¡IMPORTANTE! Responde a la pregunta: ¿Cuál es el valor de 12 8 ?