title: Cannot insert values if not exists using "NOT IN" in SQL-Server table
body: <p>By executing following queries, I cannot insert value if not exists using "NOT IN" in SQL-Server table:</p>
  
  <pre><code>CREATE TABLE tbl (Name VARCHAR(20))
  GO
  
  INSERT INTO tbl
  VALUES ('bk'), ('ck'), ('kk')
  GO
  
  CREATE TABLE #tt (Name VARCHAR(50))
  GO
  
  INSERT INTO #tt
  VALUES ('jk'), ('dk'), ('kk')
  GO
  </code></pre>
  
  <p><br /></p>
  
  <pre><code>--Script 1
  INSERT INTO tbl (Name)
      SELECT  Name
      FROM    #tt t
      WHERE   t.name NOT IN (SELECT Name FROM tbl)
  </code></pre>
  
  <p><br /></p>
  
  <pre><code>-- Script 2
  INSERT INTO tbl (Name)
      SELECT  DISTINCT t.name
      FROM    #tt t
      LEFT    JOIN tbl t1 ON t.name=t1.name
      WHERE   t1.name IS NULL
  </code></pre>