DB2 用到的基本SQL語句

passport_daizi發表於2012-06-08

匯出某個資料庫中的USER表的資料:

EXPORT TO "E:\DATE\USER.ixf" OF IXF MESSAGES "E:\DATE\USER.out" SELECT * FROM DB2ADMIN.USER

匯入到某個庫中USER表的資料:(首先建立同樣的一張USER表,然後進行匯入)

IMPORT FROM "E:\DATE\USER.ixf" OF IXF MODIFIED BY IDENTITYIGNORE MESSAGES "E:\DATE\USER.out" INSERT INTO DB2ADMIN.USER;



 

 

 

 


CREATE TABLE "DB2ADMIN".T_CONTRAST_ZL_TO_NEUSOFT (
  ZLTONEUID INTEGERNOT NULL,
  ZLJGBM VARCHAR(25),
  ZLJGMC VARCHAR(25),
  DRJGBM VARCHAR(25),
  DRJGMC VARCHAR(25),
  DBPP VARCHAR(1),
FJJGBM VARCHAR(25),
FJJGMC VARCHAR(25)

  IN "USERSPACE1"
  INDEX IN "USERSPACE1";


ALTER TABLE "DB2ADMIN".T_CONTRAST_ZL_TO_NEUSOFT
  DATA CAPTURE NONE
  PCTFREE 0
  LOCKSIZE ROW
  APPEND OFF
  NOT VOLATILE;


COMMENT ON TABLE "DB2ADMIN".T_CONTRAST_ZL_TO_NEUSOFT IS '中聯與東軟機構對比表';


COMMENT ON "DB2ADMIN".T_CONTRAST_ZL_TO_NEUSOFT ( 
ZLTONEUID IS '對比表主鍵',
ZLJGBM IS 'A機構程式碼',
ZLJGMC IS 'A機構名稱',
DRJGBM IS 'B機構編碼',
DRJGMC IS 'B機構名稱',
DBPP IS '對比匹配(Y完全匹配,ZA存在,DB存在)',
FJJGBM IS '父級機構編碼',
FJJGMC IS '父級機構名稱');


alter table T_CONTRAST_ZL_TO_NEUSOFT add   primary   key(ZLTONEUID);
COMMIT;


insert into T_CONTRAST_ZL_TO_NEUSOFT values(2,'ZL_002','A機構名稱_2','DR_002','B機構名稱_2','Y','FJ_02','父級機構名稱_2');


--更改表結構:
alter table T_CONTRAST_ZL_TO_NEUSOFT add FJJGBM VARCHAR(25);
alter table T_CONTRAST_ZL_TO_NEUSOFT  add FJJGMC VARCHAR(25);

相關文章