Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Lionheart
Starting Member
41 Posts |
Posted - 2009-10-09 : 14:30:40
|
I need to update a column of values in a table using a calculation, but truncate the value at a maximum.At the moment I have the following code.Update Eventset Value = Value * (VariableA/VariableB) What I need to do is set it so that if the value is above 130M then it truncates at 130M and inserts that value.ThxLH |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-09 : 14:36:17
|
do you mean this?Update Eventset Value = case when Value * (VariableA/VariableB) >yourquantity then yourquantity else Value * (VariableA/VariableB) end |
 |
|
|
Lionheart
Starting Member
41 Posts |
Posted - 2009-10-09 : 14:38:02
|
| That's exactly what I mean. Thanks very much.LH |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-09 : 14:41:19
|
welcome |
 |
|
|
|
|
|