/**Begin D:\pdm\PDM_UPGRADE\pdm1\BDM_constraint.sql **/
 EXEC P_ALTERPK 'PK_BDM_EP_RELATE_SERVER', 'T_BDM_EP_RELATE_SERVER', 'FENTRYID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_EP_RELATE_SERVER_FK') CREATE  CLUSTERED INDEX IDX_BDM_EP_RELATE_SERVER_FK ON T_BDM_EP_RELATE_SERVER ( FID );


 EXEC P_ALTERPK 'PK_BDM_INVOICE_APPLY_AGENT', 'T_BDM_INVOICE_APPLY_AGENT', 'FENTRYID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_INVOICE_APPLY_AGENT_FK') CREATE  CLUSTERED INDEX IDX_BDM_INVOICE_APPLY_AGENT_FK ON T_BDM_INVOICE_APPLY_AGENT ( FID );


 EXEC P_ALTERPK 'PK_BDM_TAXCLASSIFICATION', 'T_BDM_TAXCLASSIFICATION', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_TAXCLASSIFICATION') CREATE  CLUSTERED INDEX IDX_BDM_TAXCLASSIFICATION ON T_BDM_TAXCLASSIFICATION ( FNUMBER );


 EXEC P_ALTERPK 'PK_BDM_EP_MONITOR_INFO', 'T_BDM_EP_MONITOR_INFO', 'FENTRYID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_EP_MONITOR_INFO_FK') CREATE  CLUSTERED INDEX IDX_BDM_EP_MONITOR_INFO_FK ON T_BDM_EP_MONITOR_INFO ( FID );


 EXEC P_ALTERPK 'PK_BDM_EP_CHECKED_TAX', 'T_BDM_EP_CHECKED_TAX', 'FENTRYID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_EP_CHECKED_TAX_FK') CREATE  CLUSTERED INDEX IDX_BDM_EP_CHECKED_TAX_FK ON T_BDM_EP_CHECKED_TAX ( FID );


 EXEC P_ALTERPK 'PK_BDM_EP_INVOICE_APPLY', 'T_BDM_EP_INVOICE_APPLY', 'FENTRYID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_EP_INVOICE_APPLY_FK') CREATE  CLUSTERED INDEX IDX_BDM_EP_INVOICE_APPLY_FK ON T_BDM_EP_INVOICE_APPLY ( FID );


 EXEC P_ALTERPK 'PK_BDM_SERVICE_REGISTER', 'T_BDM_SERVICE_REGISTER', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_SERVICE_REGISTER') CREATE  CLUSTERED INDEX IDX_BDM_SERVICE_REGISTER ON T_BDM_SERVICE_REGISTER ( FEPINFO );


 EXEC P_ALTERPK 'PK_BDM_ENTERPRISE_BASEINFO', 'T_BDM_ENTERPRISE_BASEINFO', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_ENTERPRISE_BASEINFO') CREATE  CLUSTERED INDEX IDX_BDM_ENTERPRISE_BASEINFO ON T_BDM_ENTERPRISE_BASEINFO ( FDEVNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_EP_BASEINFO_TAXNO') CREATE INDEX IDX_BDM_EP_BASEINFO_TAXNO ON T_BDM_ENTERPRISE_BASEINFO ( FNUMBER ,FVIRTUALDEVID );


 EXEC P_ALTERPK 'PK_BDM_ENTERPRISE_INFO', 'T_BDM_ENTERPRISE_INFO', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_ENTERPRISE_INFO_EDX') CREATE  CLUSTERED INDEX IDX_BDM_ENTERPRISE_INFO_EDX ON T_BDM_ENTERPRISE_INFO ( FZGSWJGDM );


 EXEC P_ALTERPK 'PK_BDM_TAXRATE_CODE', 'T_BDM_TAXRATE_CODE', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_TAXRATE_CODE') CREATE  CLUSTERED INDEX IDX_BDM_TAXRATE_CODE ON T_BDM_TAXRATE_CODE ( FNUMBER ,FSIMPLECODENAME );


 EXEC P_ALTERPK 'PK_BDM_TAXRATE_CODE_L', 'T_BDM_TAXRATE_CODE_L', 'FPKID', '0';

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


 EXEC P_ALTERPK 'PK_BDM_GOODS_INFO', 'T_BDM_GOODS_INFO', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_GOODS_INFO_GOODSCODE') CREATE  CLUSTERED INDEX IDX_BDM_GOODS_INFO_GOODSCODE ON T_BDM_GOODS_INFO ( FGOODSCODE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_GOODS_INFO_ORG') CREATE INDEX IDX_BDM_GOODS_INFO_ORG ON T_BDM_GOODS_INFO ( FORG );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_GOODS_INFO_TAXCODE') CREATE INDEX IDX_BDM_GOODS_INFO_TAXCODE ON T_BDM_GOODS_INFO ( FTAXCODE );


 EXEC P_ALTERPK 'PK_BDM_TAX_EQUIPMENT', 'T_BDM_TAX_EQUIPMENT', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_TAX_EQUIPMENT_DX') CREATE  CLUSTERED INDEX IDX_BDM_TAX_EQUIPMENT_DX ON T_BDM_TAX_EQUIPMENT ( FTAXNO );


 EXEC P_ALTERPK 'PK_BDM_PARAM_CONFIG', 'T_BDM_PARAM_CONFIG', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_PARAM_CONFIG') CREATE  CLUSTERED INDEX IDX_BDM_PARAM_CONFIG ON T_BDM_PARAM_CONFIG ( FCONFIG_TYPE );


 EXEC P_ALTERPK 'PK_BDM_ORG', 'T_BDM_ORG', 'FID', '0';

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


 /** EXEC P_ALTERPK 'PK_BDM_PREMISSION_INFO', 'T_BDM_PREMISSION_INFO', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_PREMISSION_INFO_APPID') CREATE  CLUSTERED INDEX IDX_BDM_PREMISSION_INFO_APPID ON T_BDM_PREMISSION_INFO ( FIMCAPPID ); **/


 EXEC P_ALTERPK 'PK_BDM_INVOICE_PERMISSION', 'T_BDM_INVOICE_PERMISSION', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BDM_INVOICE_PERMISSION') CREATE  CLUSTERED INDEX IDX_BDM_INVOICE_PERMISSION ON T_BDM_INVOICE_PERMISSION ( FEPINFO ,FSERVERGROUP );



/**End D:\pdm\PDM_UPGRADE\pdm1\BDM_constraint.sql **/
