
/*------ ATD 480729 ------*/
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'DADOSITEMTRIBUTOS' AND COLUMN_NAME = 'vIBSEstCred')
BEGIN
    ALTER TABLE DADOSITEMTRIBUTOS ADD vIBSEstCred DECIMAL(15,2)
END;

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'DADOSITEMTRIBUTOS' AND COLUMN_NAME = 'vCBSEstCred')
BEGIN
    ALTER TABLE DADOSITEMTRIBUTOS ADD vCBSEstCred DECIMAL(15,2)
END;


IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'DADOSNOTATRIBUTOS' AND COLUMN_NAME = 'vIBSEstCred')
BEGIN
    ALTER TABLE DADOSNOTATRIBUTOS ADD vIBSEstCred DECIMAL(15,2)
END;

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'DADOSNOTATRIBUTOS' AND COLUMN_NAME = 'vCBSEstCred')
BEGIN
    ALTER TABLE DADOSNOTATRIBUTOS ADD vCBSEstCred DECIMAL(15,2)
END;        

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'DADOSITEMTRIBUTOS' AND COLUMN_NAME = 'nItemRef' AND NUMERIC_PRECISION < 5)
BEGIN
	ALTER TABLE DADOSITEMTRIBUTOS ALTER COLUMN nItemRef NUMERIC(5,0)
END;