I have a table with the column
name: variant_markup
datatype: numeric(4,3)
I try to put value 10.000 into it
And I get the Error
An error occurred while updating the entries
10.000 Out of range
It shouldn’t be, and I have other columns with same data type and the same process to add a number in, and they don’t complain!
The code:
decimal strippedMarkRate = decimal.Round(0, 3);
if (MarkUpTextBox.Text != string.Empty)
strippedMarkRate = decimal.Round(decimal.Parse(toolbox.removeChars(MarkUpTextBox.Text)), 3);
variant_markup = strippedMarkRate;
toolbox.removeChars function just removes any character that isn’t a digit or a decimal point from the box, is there a way to do this with regex by anychance?
If you want to insert 10.000 then your data type needs to be defined as numeric(5,3). The first digit in the numeric type declaration is the maximum number of digits in the number (precision). In the case of 10.000, there are 5.
decimal and numeric (Transact-SQL)