mssql which is the syntax 'if' : <p>I have this code in mssql:</p>

<pre><code>SELECT
    t1.Id,
    t2.Id,
    t1.QuantityIn,
    t1.PriceIn,
    t2.QuantityOut,

    (If (t2.QuantityOut - t1.QuantityIn)=0

        THEN t2.QuantityOut

    Else t2.QuantityOut - t1.QuantityIn ) AS Quant,

    t2.PriceOut

FROM t1

LEFT JOIN t2 ON t2.Id = t1.Id
</code></pre>

<p>In software MsSql Server Management Studio error is </p>

<blockquote>
  <p>Incorrect syntax near the keyword 'If'.</p>
</blockquote>

<p>What is the correct syntax for 'if' in my case?</p>

<p>Thank you!</p>
