title: Display the result column name from COALESCE result using SQL SERVER 2008?
body: <p>Can someone help me with the below query update the RESULTANT COLUMN NAME EG:A OR B OR C after using the COALESCE function?</p>
  
  <p>Example:</p>
  
  <p>Table:</p>
  
  <pre><code>A - null,
  B - null,
  C - 5
  
  select COALESCE(A,B,C) As [COL1], [COL2]
  from TABLE
  </code></pre>
  
  <p>In this case [Col2] should display the column name as 'C'</p>
  
  <p>Result:</p>
  
  <pre><code>[COl1] = 5
  [Col2] = C   (Displays the Column Name)
  </code></pre>
  
  <p>Thanks,
  Kavin</p>