EXEC P_ALTERPK 'PK_PBD_LINKBILLNODE', 'T_PBD_LINKBILLNODE', 'FID', '1';

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

EXEC P_ALTERPK 'PK_PBD_DEFINELINKBILL', 'T_PBD_DEFINELINKBILL', 'FID', '1';

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

EXEC P_ALTERPK 'PK_PBD_EXECUTETRACKING', 'T_PBD_EXECUTETRACKING', 'FID', '1';

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

EXEC P_ALTERPK 'PK_PBD_TRACKINGENTRY', 'T_PBD_TRACKINGENTRY', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PBD_TRACKINGENTRY_FID') CREATE INDEX IDX_PBD_TRACKINGENTRY_FID ON T_PBD_TRACKINGENTRY ( FID ,FSOURCEENTITYID );

EXEC P_ALTERPK 'PK_PBD_TRACKINGDETAIL', 'T_PBD_TRACKINGDETAIL', 'FDETAILID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PBD_TRACKINGDETAIL_FID') CREATE INDEX IDX_PBD_TRACKINGDETAIL_FID ON T_PBD_TRACKINGDETAIL ( FID ,FENTRYID );