
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_MROORDERTYPE') 
 CREATE TABLE T_FMM_MROORDERTYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCLASSIFY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPREINSET CHAR(1) DEFAULT '0' NOT NULL
);

 EXEC P_ALTERPK 'PK_FMM_MROORDERTYPE', 'T_FMM_MROORDERTYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_MROORDERTYPE_FNUMBER') CREATE INDEX IDX_FMM_MROORDERTYPE_FNUMBER ON T_FMM_MROORDERTYPE ( FNUMBER );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_MROORDERTYPE_L') 
 CREATE TABLE T_FMM_MROORDERTYPE_L (
FPKID NVARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);

 EXEC P_ALTERPK 'PK_FMM_MROORDERTYPE_L', 'T_FMM_MROORDERTYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_MROORDERTYPE_L_0') CREATE INDEX IDX_FMM_MROORDERTYPE_L_0 ON T_FMM_MROORDERTYPE_L ( FID ,FLOCALEID );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FMM_MROORDERTYPE' AND KSQL_COL_NAME ='FISSHOWLIST') 
ALTER TABLE T_FMM_MROORDERTYPE ADD (FISSHOWLIST CHAR(1) NOT NULL DEFAULT '1');