title: Compare table with a table variable in a Stored procedure in SQL Server 2005
body: <p>How to compare a table against a table variable in a Stored Procedure? Normally to compare the two tables we used this query:</p>
  
  <pre><code> SELECT * 
   FROM Table A 
   WHERE NOT EXISTS(SELECT * 
                    FROM Table B 
                    WHERE Table A.ID = Table B.ID)
  </code></pre>
  
  <p>But here, I have <code>Table A</code> and one table variable <code>@Item</code> like Table B.</p>
  
  <p>In this scenario, how to compare <code>Table A</code> and <code>@Item</code>?</p>
  
  <p>I am writing one stored procedure, in that stored procedure I want to compare the existing one table with the table variable which is generated from the front end and passed as a XML dataset to the Stored Procedure...
  In that, if all the rows in the table variable @Item presents in the existing table then it returns true else false...</p>
  
  <p>Any suggestions please....</p>