Using CASE Statements In A SQL UPDATE Query

user following CASE statement:

UPDATE [account]
 SET
  balance =
  (
   CASE
    WHEN ((balance - 10.00) < 0)
    THEN 0
    ELSE (balance - 10.00)
   END
  )
 WHERE
  id = 1
UPDATE [account]
 SET
  balance =
  (
   CASE
    WHEN ((balance - 10.00) < 0)
    THEN 0
    ELSE (balance - 10.00)
   END
  )
 WHERE
  id = 1
  1. <code>
  2. UPDATE [account]
  3. SET
  4. balance =
  5. (
  6. CASE
  7. WHEN ((balance - 10.00) < 0)
  8. THEN 0
  9. ELSE (balance - 10.00)
  10. END
  11. )
  12. WHERE
  13. id = 1
  14. </code>
<code>
UPDATE [account]
 SET
  balance =
  (
   CASE
    WHEN ((balance - 10.00) < 0)
    THEN 0
    ELSE (balance - 10.00)
   END
  )
 WHERE
  id = 1
</code>

Popular posts from this blog

Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=xx.0.0.0, Culture=neutral, PublicKeyToken='xxx' or one of its dependencies.

C# Crop white space from around the image

The specified version string contains wildcards, which are not compatible with determinism.