/**Begin D:\pdm\PDM_UPGRADE\pdm_new\RIM_constraint.sql **/
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RIM_INV_ORDINARY_ORG') CREATE INDEX IDX_RIM_INV_ORDINARY_ORG ON T_RIM_INV_ORDINARY ( FORG_ID ,FINVOICE_TYPE );

 EXEC P_ALTERPK 'PK_RIM_QUERY_CONFIG', 'T_RIM_QUERY_CONFIG', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RIM_QUERY_CONFIG_NO') CREATE UNIQUE INDEX IDX_RIM_QUERY_CONFIG_NO ON T_RIM_QUERY_CONFIG ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RIM_QUERY_CONFIG_TYPE') CREATE UNIQUE  CLUSTERED INDEX IDX_RIM_QUERY_CONFIG_TYPE ON T_RIM_QUERY_CONFIG ( FCONFIGTYPE ,FQUERYTYPE ,FINVOICETYPE );


 EXEC P_ALTERPK 'PK_RIM_QUERY_CONFIG_ITEM', 'T_RIM_QUERY_CONFIG_ITEM', 'FENTRYID', '0';

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


 EXEC P_ALTERPK 'PK_RIM_QUERY_CONFIG_ITEM_L', 'T_RIM_QUERY_CONFIG_ITEM_L', 'FPKID', '0';

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


/**End D:\pdm\PDM_UPGRADE\pdm_new\RIM_constraint.sql **/
