CREATE TABLE [MES].[USER_DEF_PROCESS]( PCS_NO NUMERIC(38) NOT NULL, STATUS VARCHAR(5) NOT NULL, TYPE VARCHAR(5) NOT NULL, DEF_NO NUMERIC(38) , BOMI_NO NUMERIC(38) , PCS_POS SMALLINT , PLANT_ID VARCHAR(64) , WORK_CENTER VARCHAR(64) , EQP_NO NUMERIC(38) , DURATION VARCHAR(512) , UOM_ID VARCHAR(3) , REMARK VARCHAR(512) , [EXT_TYPE01] [varchar](5) NULL, [EXT_TYPE02] [varchar](5) NULL, [EXT_TYPE03] [varchar](5) NULL, [EXT_VALUE01] [varchar](512) NULL, [EXT_VALUE02] [varchar](512) NULL, [EXT_VALUE03] [varchar](512) NULL, [EXT_VALUE04] [varchar](512) NULL, [EXT_VALUE05] [varchar](512) NULL, [EXT_VALUE06] [varchar](512) NULL, [EXT_VALUE07] [varchar](512) NULL, [EXT_VALUE08] [varchar](512) NULL, [EXT_VALUE09] [varchar](512) NULL, [EXT_VALUE10] [varchar](512) NULL, [EXT_QTY01] [numeric](18, 3) NULL, [EXT_QTY02] [numeric](18, 3) NULL, [EXT_QTY03] [numeric](18, 3) NULL, [EXT_QTY04] [numeric](18, 3) NULL, [EXT_TIME01] [datetime2](7) NULL, [EXT_TIME02] [datetime2](7) NULL, [EXT_TIME03] [datetime2](7) NULL ); ALTER TABLE [MES].[USER_DEF_PROCESS] ADD CONSTRAINT USER_DEF_PROCESS_PK PRIMARY KEY (PCS_NO); ALTER TABLE [MES].[USER_DEF_PROCESS] WITH CHECK ADD CONSTRAINT [USER_DEF_PROCESS_DEF_NO_FK] FOREIGN KEY([DEF_NO]) REFERENCES [MES].[MM_DEFINITION] ([DEF_NO]) GO ALTER TABLE [MES].[USER_DEF_PROCESS] CHECK CONSTRAINT [USER_DEF_PROCESS_DEF_NO_FK] GO ALTER TABLE [MES].[USER_DEF_PROCESS] WITH CHECK ADD CONSTRAINT [USER_DEF_PROCESS_EQP_NO_FK] FOREIGN KEY([EQP_NO]) REFERENCES [MES].[PM_EQUIPMENT] ([EQP_NO]) GO ALTER TABLE [MES].[USER_DEF_PROCESS] CHECK CONSTRAINT [USER_DEF_PROCESS_EQP_NO_FK] GO