title: Output value and whether it exists in SQL Server 2008 Database
body: <p>I am trying to create a query that outputs (1) The value (2) Whether the value exists or not. I tried </p>
  
  <pre><code>SELECT CASE WHEN EXISTS (
      SELECT [IP_ADDR1_TEXT]
      FROM [dbo].[V_SEM_COMPUTER]
      WHERE [IP_ADDR1_TEXT] = '10.10.10.10'
  ) , [IP_ADDR1_TEXT] 
  THEN CAST(1 AS BIT)
  ELSE CAST(0 AS BIT) END
  </code></pre>
  
  <p>And I get error. Thanks.</p>
  
  <p>CLARIFICATION</p>
  
  <p>When I try </p>
  
  <pre><code>SELECT CASE WHEN EXISTS (
      SELECT [IP_ADDR1_TEXT]
      FROM [dbo].[V_SEM_COMPUTER]
      WHERE [IP_ADDR1_TEXT] = '10.10.10.10'
  ) 
  THEN CAST(1 AS BIT)
  ELSE CAST(0 AS BIT) END
  </code></pre>
  
  <p>It only outputs 1 or 0. I would like it to output the IP address, and 1 or 0, depending on whether it exists or not.</p>
  
  <pre><code>IP Address   EXISTS
  10.10.10.10    1
  </code></pre>