I am trying to take an existing column with money values in it, and use those to set a value in another column which is a decimal. As an example, if I have “8.65” as my money value, I am trying to set a decimal value/column associated with that same record as “8.6500000000”. In my case, I need 10 decimal points of precision.
This is the code I tried which failed to do anything (it did not give an error, it just did not update any records):
SET abc_PaidDecimal = CAST(abc_PaidAmnt AS DECIMAL(16,10))
WHERE abc_PaidDecimal <> CAST(abc_PaidAmnt AS DECIMAL(16,10))
You can get this behavior if your abc_PaidDecimal contains NULL. NULLs cannot be compared to any other value, the only valid comparison for them is to use IS NULL or IS NOT NULL.
So, try adding
or abc_PaidDecimal IS NULLto yourWHEREclause