title: Using a IF Statement within a TSQL UPDATE
body: <p>I want to update two columns in a table.  The value of the second column is dependant upon the first;  If the first is Null the second's value is 'false', otherwise it is 'true'.<br>
  Can I do this within TSQL or do I need to work out the values separately in my code before hand and change the SQL to suit.  I was looking for something like:</p>
  
  <pre><code>DECLARE @NewColumnValue as nvarchar(10);
  SELECT @NewColumnValue = ColumnY From TableY
  UPDATE TableX  
  SET Column1 = @NewColumnValue,
  Column2 = (IF (@NewColumnValue IS NULL) THEN 'False' ELSE 'True');
  </code></pre>