I need to update the Amount column with a randomized values for every row present in the above table.
However, there are a few rules that I need to meet for this:
- For TransactionType = Deposit, the randomized value must be between $10 and $20.
- For everything else, the randomized value MUST be between between $0.01 and $1 AND LESS OR EQUAL than the original Amount that we are randomizing.
So for example for ID = 7 the randomized value must be between $0.01 and $0.80.
I am struggling to get the results I want with the RAND, CHECKSUM, NEWID functions. Sometimes even getting 0 (zero) as a randomized value for some reason.
This is in SQL Server.

You would need to add another cast to check if the amount is smaller than the 0.99
fiddle
#m with DECIMAL as Datatype it get a bit easier
fiddle