Using an If or Then statement in MSSQL to calulate a field dependant on the value of another field in the same table

I am new at SQL and am trying to design a calculated field that is dependent on the value of another field


I have a "total_Comm field" who's calculated value is dependent on the value of a "VAT field" either being yes or no and "Comission_paid field" so that if the value is yes then the calculated field will be "Comission_paid field" * 1.175 or if no then "Comission_paid field" * 1

I have tried the alter table statement below but keep getting a syntax error. Also I am not sure that the logic of this is right or if there is a better way to do this

ALTER TABLE [Actual Recuring Comm]
  ADD Total_Comm AS
    CASE Commission_paid
       WHEN 0 THEN 0
IF "VAT = Yes"
THEN (Comission_paid * 1.175)
IF "VAT = No"
THEN Commission_paid * 1

Any help or pointers would be appreciated

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


ALTER TABLE [Actual Recuring Comm]
  ADD Total_Comm AS
        when Commission_paid = 0 then 0
        when [Vat Column Name] = 'Yes' then [Comission_paid column name] * 1.175
        when [Vat Column Name] = 'No' then [Comission_paid column name]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
21agdgcfAuthor Commented:
Many thanks for quick respose it works fine
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.