Wednesday, 29 August 2018

DB2 - Create a Copy of Table


Below will create an empty table

create table MPI_MY_TABLE_bkp as (select * from MPI_MY_TABLE ) WITH NO DATA ;

or

db2 "create table analysis_LoadData as (select memidnum as tmemrecno,memidnum as tmemidnum,memidnum as tbsilo from mpi_memhead fetch first 1 rows only) with no data"



with Data doesn't work in DB2 version 10.5


INSERT INTO MPI_MY_TABLE_bkp (SELECT FROM MPI_MY_TABLE);

or


db2 "CREATE TABLE "ramitTempMemrecnoEIDMemIDNum" ( MEMRECNO BIGINT, EID BIGINT, MEMIDNUM VARCHAR(240) )
"



No comments:

Post a Comment