/**Begin D:\PDM_UPGRADE\PDM1\BRM_constraint.sql **/
 EXEC P_ALTERPK 'PK_BRM_SCENE_HIS_L', 'T_BRM_SCENE_HIS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_SCENE_L', 'T_BRM_SCENE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_SCENEINPUT_HIS_L', 'T_BRM_SCENEINPUT_HIS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_SCENEINPUT_L', 'T_BRM_SCENEINPUT_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_SCENEINPUT_L') CREATE INDEX IDX_BRM_SCENEINPUT_L ON T_BRM_SCENEINPUT_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_BRM_SCENEOUTPUT_HIS_L', 'T_BRM_SCENEOUTPUT_HIS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_SCENEOUTPUT_L', 'T_BRM_SCENEOUTPUT_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_SCENEOUTPUT_L') CREATE INDEX IDX_BRM_SCENEOUTPUT_L ON T_BRM_SCENEOUTPUT_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_BRM_TARGET_HIS', 'T_BRM_TARGET_HIS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_TARGETHIS_TARGETID') CREATE INDEX IDX_BRM_TARGETHIS_TARGETID ON T_BRM_TARGET_HIS ( FTARGETID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_TARGETHIS_OPERATOR') CREATE INDEX IDX_BRM_TARGETHIS_OPERATOR ON T_BRM_TARGET_HIS ( FOPERATORID );


 EXEC P_ALTERPK 'PK_BRM_TARGETREF', 'T_BRM_TARGETREF', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_TARGETREF_PRT') CREATE INDEX IDX_BRM_TARGETREF_PRT ON T_BRM_TARGETREF ( FPOLICYID ,FDESIGNRULEID ,FTARGETID );


 EXEC P_ALTERPK 'PK_BRM_SCENE_HIS', 'T_BRM_SCENE_HIS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_SCENE_HIS') CREATE INDEX IDX_BRM_SCENE_HIS ON T_BRM_SCENE_HIS ( FSCENEID ,FNUMBER );


 EXEC P_ALTERPK 'PK_BRM_SCENEINPUT_HIS', 'T_BRM_SCENEINPUT_HIS', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_SCENEOUTPUT_HIS', 'T_BRM_SCENEOUTPUT_HIS', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_POLICY_HIS', 'T_BRM_POLICY_HIS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_POLICY_HIS') CREATE INDEX IDX_BRM_POLICY_HIS ON T_BRM_POLICY_HIS ( FPOLICYID ,FNUMBER );


 EXEC P_ALTERPK 'PK_BRM_POLICY_HIS_L', 'T_BRM_POLICY_HIS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_RULE_HIS', 'T_BRM_RULE_HIS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_RULE_HIS') CREATE INDEX IDX_BRM_RULE_HIS ON T_BRM_RULE_HIS ( FPOLICYID ,FPOLICYNUMBER );


 EXEC P_ALTERPK 'PK_BRM_RULE_HIS_L', 'T_BRM_RULE_HIS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_SCENE', 'T_BRM_SCENE', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_SCENE_APP') CREATE INDEX IDX_BRM_SCENE_APP ON T_BRM_SCENE ( FBIZAPPID );


 EXEC P_ALTERPK 'PK_BRM_POLICYSCOPE', 'T_BRM_POLICYSCOPE', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_POLICYSCOPE') CREATE INDEX IDX_BRM_POLICYSCOPE ON T_BRM_POLICYSCOPE ( FID );


 EXEC P_ALTERPK 'PK_BRM_DRLFILTER', 'T_BRM_DRLFILTER', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_DRLFILTER') CREATE INDEX IDX_BRM_DRLFILTER ON T_BRM_DRLFILTER ( FID );


 EXEC P_ALTERPK 'PK_BRM_SCENEINPUT', 'T_BRM_SCENEINPUT', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_SCENEINPUT') CREATE INDEX IDX_BRM_SCENEINPUT ON T_BRM_SCENEINPUT ( FID );


 EXEC P_ALTERPK 'PK_BRM_SCENEOUTPUT', 'T_BRM_SCENEOUTPUT', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_SCENEOUTPUT') CREATE INDEX IDX_BRM_SCENEOUTPUT ON T_BRM_SCENEOUTPUT ( FID );


 EXEC P_ALTERPK 'PK_BRM_POLICY', 'T_BRM_POLICY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_POLICY_BAS') CREATE INDEX IDX_BRM_POLICY_BAS ON T_BRM_POLICY ( FSCENEID ,FBIZAPPID );


 EXEC P_ALTERPK 'PK_BRM_TARGET', 'T_BRM_TARGET', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_TARGET_BSS') CREATE INDEX IDX_BRM_TARGET_BSS ON T_BRM_TARGET ( FSCENEID );


 EXEC P_ALTERPK 'PK_BRM_POLICY_L', 'T_BRM_POLICY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_TARGET_L', 'T_BRM_TARGET_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_TARGET_HIS_L', 'T_BRM_TARGET_HIS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_DRLFILTER_L', 'T_BRM_DRLFILTER_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_DRLFILTER_L') CREATE INDEX IDX_BRM_DRLFILTER_L ON T_BRM_DRLFILTER_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_BRM_DRLRULE', 'T_BRM_DRLRULE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_DRLRULE') CREATE INDEX IDX_BRM_DRLRULE ON T_BRM_DRLRULE ( FRULEDESIGNID );


 EXEC P_ALTERPK 'PK_BRM_DRLKBASE', 'T_BRM_DRLKBASE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_KB_TANANTAPP') CREATE INDEX IDX_BRM_KB_TANANTAPP ON T_BRM_DRLKBASE ( FTENANTID );


 EXEC P_ALTERPK 'PK_BRM_DRLRULE_L', 'T_BRM_DRLRULE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_SPECIAL_LIST', 'T_BRM_SPECIAL_LIST', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_SPECIAL_LIST') CREATE INDEX IDX_BRM_SPECIAL_LIST ON T_BRM_SPECIAL_LIST ( FNUMBER ,FNAME );


 EXEC P_ALTERPK 'PK_BRM_SPECIAL_LIST_L', 'T_BRM_SPECIAL_LIST_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_LIST_STRING_L', 'T_BRM_LIST_STRING_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_LIST_STRING_L') CREATE INDEX IDX_BRM_LIST_STRING_L ON T_BRM_LIST_STRING_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_BRM_LIST_STRING', 'T_BRM_LIST_STRING', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_LIST_STRING') CREATE INDEX IDX_BRM_LIST_STRING ON T_BRM_LIST_STRING ( FID ,FLISTSTRINGNAME );


 EXEC P_ALTERPK 'PK_BRM_LIST_ORG', 'T_BRM_LIST_ORG', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_LIST_ORG') CREATE INDEX IDX_BRM_LIST_ORG ON T_BRM_LIST_ORG ( FID ,FENTITYORGID );


 EXEC P_ALTERPK 'PK_BRM_LIST_PERSON', 'T_BRM_LIST_PERSON', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_LIST_PERSON') CREATE INDEX IDX_BRM_LIST_PERSON ON T_BRM_LIST_PERSON ( FID ,FENTITYPERSONID );


 EXEC P_ALTERPK 'PK_BRM_POLICY_TMP', 'T_BRM_POLICY_TMP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_POLICY_LOG') CREATE INDEX IDX_BRM_POLICY_LOG ON T_BRM_POLICY_TMP ( FLOGID ,FBATCHNUMBER );


 EXEC P_ALTERPK 'PK_BRM_POLICY_TMP_L', 'T_BRM_POLICY_TMP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_POLICYSCOPE_TMP', 'T_BRM_POLICYSCOPE_TMP', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_POLICYSCOPE_TMP') CREATE INDEX IDX_BRM_POLICYSCOPE_TMP ON T_BRM_POLICYSCOPE_TMP ( FID );


 EXEC P_ALTERPK 'PK_BRM_RULE_TMP', 'T_BRM_RULE_TMP', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_RULE_TMP') CREATE INDEX IDX_BRM_RULE_TMP ON T_BRM_RULE_TMP ( FID );


 EXEC P_ALTERPK 'PK_BRM_RULE_TMP_L', 'T_BRM_RULE_TMP_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_RULE_TMP_L') CREATE INDEX IDX_BRM_RULE_TMP_L ON T_BRM_RULE_TMP_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_BRM_SCENEPARAM_TMP', 'T_BRM_SCENEPARAM_TMP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_SCENEPARAM_TMP_LOG') CREATE INDEX IDX_BRM_SCENEPARAM_TMP_LOG ON T_BRM_SCENEPARAM_TMP ( FLOGID ,FBATCHNUMBER );


 EXEC P_ALTERPK 'PK_BRM_SCENEPARAM_TMP_L', 'T_BRM_SCENEPARAM_TMP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_TARGET_TMP', 'T_BRM_TARGET_TMP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_TARGET_TMP_LOG') CREATE INDEX IDX_BRM_TARGET_TMP_LOG ON T_BRM_TARGET_TMP ( FLOGID ,FBATCHNUMBER );


 EXEC P_ALTERPK 'PK_BRM_TARGET_TMP_L', 'T_BRM_TARGET_TMP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BRM_DECISIONTABLE', 'T_BRM_DECISIONTABLE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_DECI_POLICY') CREATE INDEX IDX_BRM_DECI_POLICY ON T_BRM_DECISIONTABLE ( FPOLICYID );


 EXEC P_ALTERPK 'PK_BRM_DECISIONTABTMP', 'T_BRM_DECISIONTABTMP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BRM_DECTMP_LOG') CREATE INDEX IDX_BRM_DECTMP_LOG ON T_BRM_DECISIONTABTMP ( FLOGID ,FBATCHNUMBER );



/**End D:\PDM_UPGRADE\PDM1\BRM_constraint.sql **/
