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 |
calvinfoo
Posting Yak Master
129 Posts |
Posted - 2010-12-22 : 22:35:40
|
Hi,ItemDesc = PencilQuantity = 100QuantityReceived = nullUser can key in the Quantity Received, then I will update the record accordingly.Example:Existing Quantity is 100@Receivedif user entered @received < Quantity, then update the QuantityReceived = @received;if user entered @received >= Quantity, then update the ReceivedQuantity = QuantityHow is the SQL Command looks like for IF THEN ELSE? |
|
calvinfoo
Posting Yak Master
129 Posts |
Posted - 2010-12-22 : 22:51:17
|
Hi,I just figured out the answer:update table_name set QuantityReceived = CASE WHEN 100 > Quantity THEN Quantity ELSE 100 END |
 |
|
|
|
|