UPDATE TBPDV_CFE_ITEM T SET T.VALOR_ICMS_ST = 0 WHERE T.VALOR_ICMS_ST IS NULL;


ALTER TABLE TBNFS_ITEM ALTER VALOR_ICMS_ST SET NOT NULL;

ALTER TABLE TBPDV_CFE_ITEM ALTER VALOR_ICMS_ST SET NOT NULL;

ALTER TABLE TBPDV_CFE_ITEM ALTER COLUMN VALOR_ICMS_ST
SET DEFAULT 0;


UPDATE TBNFS_TOTAIS T SET T.VALOR_ICMS_SUBST = 0 WHERE T.VALOR_ICMS_SUBST IS NULL;

ALTER TABLE TBNFS_TOTAIS ALTER VALOR_ICMS_SUBST SET NOT NULL;

CREATE INDEX ITBPDV_CFE_ITEM_18
ON TBPDV_CFE_ITEM (VALOR_ICMS_ST);

CREATE INDEX ITBNFS_TOTAIS_01
ON TBNFS_TOTAIS (VALOR_ICMS_SUBST);

UPDATE TBNFE_TOTAIS T SET T.VALOR_ICMS_SUBST = 0 WHERE T.VALOR_ICMS_SUBST IS NULL;

ALTER TABLE TBNFE_TOTAIS ALTER VALOR_ICMS_SUBST SET NOT NULL;

CREATE INDEX ITBNFE_TOTAIS_01
ON TBNFE_TOTAIS (VALOR_ICMS_SUBST);

CREATE INDEX ITBNFS_20
ON TBNFS (EMPRESA_IE);

CREATE INDEX ITBPDV_CFE_22
ON TBPDV_CFE (CLIENTE_IE);



