CREATE TABLE customer_contract_conditions_mig (
   TENANT_NO int NOT NULL,
   CONTACT_NO int NOT NULL,
   COMPANY_NO int NOT NULL,
   DEPARTMENT_NO int NOT NULL,
   MARKET_NO int NOT NULL,
   CUSTOMER_NO int NOT NULL,
   CUSTOMER_CONTRACT_NO int NOT NULL,
   VALID_FROM timestamp NOT NULL,
   VALID_TO timestamp,
   CONDITION_CD varchar(10),
   CARD_UID varchar(36),
   CARD_NO varchar(30),
   CARD_NM varchar(100),
   SALES_PRICELIST_ID int,
   ITEM_CONDITION_CD varchar(50),
   SALES_CREDIT_CD varchar(50),
   PHASE_OUT smallint,
PRIMARY KEY  
(
	tenant_no ,
	contact_no ,
	company_no ,
	department_no ,
	customer_no ,
	customer_contract_no ,
	valid_from ,
	market_no )
);

INSERT INTO customer_contract_conditions_mig
           (tenant_no
           ,contact_no
           ,company_no
           ,department_no
           ,market_no
           ,customer_no
           ,customer_contract_no
           ,valid_from
           ,valid_to
           ,card_no
           ,card_nm
           ,sales_pricelist_id
           ,item_condition_cd
           ,sales_credit_cd
           ,phase_out)
 SELECT tenant_no
      ,contact_no
      ,company_no
      ,department_no
      ,market_no
      ,customer_no
      ,customer_contract_no
      ,valid_from
      ,valid_to
      ,card_no
      ,card_nm
      ,sales_pricelist_id
      ,item_condition_cd
      ,sales_credit_cd
      ,phase_out
  FROM customer_contract_conditions;
  