December 13, 2016 at 6:32 pm
Hi All, i am hoping for some assistance with an rounding issue i have with my current trigger. any assistance would be greatly appreciated.
'BEGIN ' + #13 +
' SELECT cast(STDBUYPRICE as decimal(18,2)) ' + #13 +
' FROM itemmaster ' + #13 +
' WHERE ITEMCODE = NEW.linecode' + #13 +
' into new.ADDITIONALFIELD_5;' + #13 + ++++THIS FIELD AT THE MOMENT HAS 10 DECIMAL PLACES, I NEED ONLY 4+++++++
' ' + #13 +
' NEW.ADDITIONALFIELD_6 = ((CAST(new.ADDITIONALFIELD_5 AS DECIMAL (18,2)) * NEW.PERBATCHQTY));' + #13 +
'END;'; ++++++THIS FIELD AT THE MOMENT HAS 10 DECIMAL PLACES, I NEED ONLY 4++++++++++++
ExecuteSQL(SQLStr);
end.
end
December 14, 2016 at 3:41 am
andrew 64169 (12/13/2016)
Hi All, i am hoping for some assistance with an rounding issue i have with my current trigger. any assistance would be greatly appreciated.'BEGIN ' + #13 +
' SELECT cast(STDBUYPRICE as decimal(18,2)) ' + #13 +
' FROM itemmaster ' + #13 +
' WHERE ITEMCODE = NEW.linecode' + #13 +
' into new.ADDITIONALFIELD_5;' + #13 + ++++THIS FIELD AT THE MOMENT HAS 10 DECIMAL PLACES, I NEED ONLY 4+++++++
' ' + #13 +
' NEW.ADDITIONALFIELD_6 = ((CAST(new.ADDITIONALFIELD_5 AS DECIMAL (18,2)) * NEW.PERBATCHQTY));' + #13 +
'END;'; ++++++THIS FIELD AT THE MOMENT HAS 10 DECIMAL PLACES, I NEED ONLY 4++++++++++++
ExecuteSQL(SQLStr);
end.
end
Sorry, I don't recognize the code you're posting although there is some SQL in it. But i will try to provide an answer:
Is it possible the number of decimals is defined in the datatype of the "new.ADDITIONALFIELD_5" and the "NEW.ADDITIONALFIELD_6" object?
December 14, 2016 at 4:48 am
Sorry, your code isn't really that easy to read.
Is there a reason you aren't ROUNDing the decimal numbers you want to format?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply