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 |
|
eem_2055
Yak Posting Veteran
69 Posts |
Posted - 2008-05-18 : 04:17:22
|
| May I know how to use If statement in T-SQL?I have a condition wherefield = if the value1 >= 500 then field =500 else field = field |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-18 : 05:28:59
|
| you need to use case herei.efield=case when value>=500 then 500 else field end |
 |
|
|
eem_2055
Yak Posting Veteran
69 Posts |
Posted - 2008-05-18 : 05:43:17
|
| many thanks I got it already..I just used 'field' = when 'field2' >= 500 then 500 when field2 < 500 then field2 end |
 |
|
|
|
|
|