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 |
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 2008-06-22 : 19:07:02
|
| Hello all !I get an error with the following sql : update recplus set QuantityInKg = ( IF Quantity_Unit_ID = 4 Quantity_ValELSE ElementWeight_Val * Quantity_Val)this is the error I get : Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'IF'.Msg 102, Level 15, State 1, Line 4Incorrect syntax near 'Quantity_Val'.I would be glad if anyone could help me !Regards, Fabianusmy favorit hoster is ASPnix : www.aspnix.com ! |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-06-22 : 19:25:01
|
| Try with CASE instead. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-22 : 23:52:54
|
| [code]update recplus set QuantityInKg = case when Quantity_Unit_ID = 4 then Quantity_Val else ElementWeight_Val * Quantity_Val end[/code] |
 |
|
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 2008-06-23 : 04:15:20
|
| thanks a lot for your kind and quick support !This solved my problem !Regards, Fabianusmy favorit hoster is ASPnix : www.aspnix.com ! |
 |
|
|
|
|
|