/**Begin D:\PDM_UPGRADE\PDM1\PUR_constraint.sql **/
EXEC P_ALTERPK 'PK_PUR_SCDATACHANNEL', 'T_PUR_SCDATACHANNEL', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SCDATACHANNEL_FNUMBER') CREATE UNIQUE INDEX IDX_PUR_SCDATACHANNEL_FNUMBER ON T_PUR_SCDATACHANNEL ( FNUMBER );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SDCH_FERPSTATUS') CREATE UNIQUE INDEX IDX_PUR_SDCH_FERPSTATUS ON T_PUR_SCDATACHANNEL ( FCONNECTERP ,FENABLE );

EXEC P_ALTERPK 'PK_T_PUR_SCDATAHANDLE', 'T_PUR_SCDATAHANDLE', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_PUR_SDH_FNUMBER') CREATE UNIQUE INDEX IDX_T_PUR_SDH_FNUMBER ON T_PUR_SCDATAHANDLE ( FNUMBER );

EXEC P_ALTERPK 'PK_PUR_REFSCDATAHANDLE', 'T_PUR_REFSCDATAHANDLE', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_PUR_SDH_REF_FID') CREATE INDEX IDX_T_PUR_SDH_REF_FID ON T_PUR_REFSCDATAHANDLE ( FID ,FSCDATASERVICEID );

EXEC P_ALTERPK 'PK_PUR_REFSCDATACONFIG', 'T_PUR_REFSCDATACONFIG', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_PUR_SDC_REF_FID') CREATE INDEX IDX_T_PUR_SDC_REF_FID ON T_PUR_REFSCDATACONFIG ( FID ,FSCDATACONFIGID );

EXEC P_ALTERPK 'PK_T_PUR_SCDATAHANDLEFAIL', 'T_PUR_SCDATAHANDLEFAIL', 'FID', '1';

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

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_PUR_SDHF_FSCDHID') CREATE INDEX IDX_T_PUR_SDHF_FSCDHID ON T_PUR_SCDATAHANDLEFAIL ( FSCDATAHANDLEID );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_PUR_SDHF_FCREATETIME') CREATE INDEX IDX_T_PUR_SDHF_FCREATETIME ON T_PUR_SCDATAHANDLEFAIL ( FCREATETIME );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_PUR_SDHF_FSTATE') CREATE INDEX IDX_T_PUR_SDHF_FSTATE ON T_PUR_SCDATAHANDLEFAIL ( FSTATE );

EXEC P_ALTERPK 'PK_T_PUR_SCDATASERVICE', 'T_PUR_SCDATASERVICE', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_PUR_SDS_FNUMBER') CREATE UNIQUE INDEX IDX_T_PUR_SDS_FNUMBER ON T_PUR_SCDATASERVICE ( FNUMBER );

EXEC P_ALTERPK 'PK_T_PUR_SCDATACONFIG', 'T_PUR_SCDATACONFIG', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_PUR_SDC_FNUMBER') CREATE UNIQUE INDEX IDX_T_PUR_SDC_FNUMBER ON T_PUR_SCDATACONFIG ( FNUMBER );
/**End D:\PDM_UPGRADE\PDM1\PUR_constraint.sql **/
