 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_DPSALLOCENTRY') CREATE INDEX IDX_Y_MDS_DPSALLOCENTRY ON T_MDS_DPSALLOCENTRY ( FID ,FSEQ );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_DPSALLOCRESULT') CREATE INDEX IDX_Y_MDS_DPSALLOCRESULT ON T_MDS_DPSALLOCRESULT ( FORGSITEID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_DPSALLOCRESULT_L') CREATE INDEX IDX_Y_MDS_DPSALLOCRESULT_L ON T_MDS_DPSALLOCRESULT_L ( FID ,FLOCALEID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_DPSFNRESULT') CREATE INDEX IDX_Y_MDS_DPSFNRESULT ON T_MDS_DPSFNRESULT ( FORGSITEID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_DPSFNRESULT_L') CREATE INDEX IDX_Y_MDS_DPSFNRESULT_L ON T_MDS_DPSFNRESULT_L ( FID ,FLOCALEID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_DPSPLANEXEC') CREATE INDEX IDX_Y_MDS_DPSPLANEXEC ON T_MDS_DPSPLANEXEC ( FORGID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_DPSPLANEXEC_L') CREATE INDEX IDX_Y_MDS_DPSPLANEXEC_L ON T_MDS_DPSPLANEXEC_L ( FID ,FLOCALEID );
 EXEC P_ALTERPK 'PK_T_MDS_FNREPORTBK', 'T_MDS_FNREPORTBK', 'FID', '1';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_FNREPORTBK') CREATE INDEX IDX_Y_MDS_FNREPORTBK ON T_MDS_FNREPORTBK ( FBILLNO );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_MATERIALGPENTRY') CREATE INDEX IDX_Y_MDS_MATERIALGPENTRY ON T_MDS_MATERIALGPENTRY ( FID ,FBASEDATAID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_NUM_MDS_SITEBASEDATA') CREATE INDEX IDX_NUM_MDS_SITEBASEDATA ON T_MDS_SITEBASEDATA ( FNUMBER );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SITEBASEDATA_L') CREATE INDEX IDX_Y_MDS_SITEBASEDATA_L ON T_MDS_SITEBASEDATA_L ( FID ,FLOCALEID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SITEBASEENTRY') CREATE INDEX IDX_Y_MDS_SITEBASEENTRY ON T_MDS_SITEBASEENTRY ( FID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SITEBASESET') CREATE INDEX IDX_Y_MDS_SITEBASESET ON T_MDS_SITEBASESET ( FID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SITEBASESTATUS') CREATE INDEX IDX_Y_MDS_SITEBASESTATUS ON T_MDS_SITEBASESTATUS ( FID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SITEBASETYPE') CREATE INDEX IDX_Y_MDS_SITEBASETYPE ON T_MDS_SITEBASETYPE ( FID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SITEDPSVERSION') CREATE INDEX IDX_Y_MDS_SITEDPSVERSION ON T_MDS_SITEDPSVERSION ( FID ,FBASEDATAID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SITESCHEMEDEF') CREATE INDEX IDX_Y_MDS_SITESCHEMEDEF ON T_MDS_SITESCHEMEDEF ( FNUMBER );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SITESCHEMEDEF_L') CREATE INDEX IDX_Y_MDS_SITESCHEMEDEF_L ON T_MDS_SITESCHEMEDEF_L ( FID ,FLOCALEID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SITETRANPRODUCT') CREATE INDEX IDX_Y_MDS_SITETRANPRODUCT ON T_MDS_SITETRANPRODUCT ( FID ,FBASEDATAID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SYNCPLANLOG') CREATE INDEX IDX_Y_MDS_SYNCPLANLOG ON T_MDS_SYNCPLANLOG ( FNUMBER );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_Y_MDS_SYNCPLANLOG_L') CREATE INDEX IDX_Y_MDS_SYNCPLANLOG_L ON T_MDS_SYNCPLANLOG_L ( FID ,FLOCALEID ); 
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_DPSTREELOGEENT') CREATE INDEX IDX_MDS_DPSTREELOGEENT ON T_MDS_DPSTREELOGEENTRY ( FID );



