title: remove duplicate values while insertion
body: <p>Hi I am trying to insert values from excel sheet into SQL Database in java. SQL database has already some rows inserted by some other techniques. Now I need to insert new rows from excel sheet  and should eliminate the duplicate values which are existed in the database as well as in the excel sheet. For that I write a query like this.</p>
  
  <p>First I inserted the records from excelsheet into SQL database by using insert query</p>
  
  <pre><code>    Statement.executeUpdate(("INSERT INTO dbo.Company(CName,DateTimeCreated) values 
     ('"+Cname”' ,'"+ts+"');
  </code></pre>
  
  <p>Later I deleted the duplicate values using delete query.</p>
  
  <pre><code>      String comprows="delete from dbo.Company  where Id not in"
                  + "(select min(Id) from dbo.Company "
                  + "group by CName having count(*)&gt;=1)";
            statement3.executeUpdate(comprows);
  </code></pre>
  
  <p>where Id is autoincremented integer.
  but it is not good to do insert and then delete.
  How do I know the values are already exist? If it is exist how do I remove during insertion???</p>