I have the following SQL statement

```
INSERT INTO A_Table (field1, field2) 
  SELECT field1, field2 FROM B_Table
  WHERE field1 NOT IN (
    SELECT field1 FROM A_Table);

```

basically, I need to copy all the data from B\_Table to A\_Table, with a constrain: field1 from B\_Table not existing in A\_Table. I need to add this constrain since field1 is a key.

It looks like a conflict: field1 not in A\_Table being copied from B\_Table to A\_Table. During the inserting process, the copied record from B\_Table will exist in A\_Table. Not sure if it does work or not, or any unexpected result?

Maybe it is OK. The last SELECT is cached in a temporary table, and not refreshed during inserting?

By the way, my SQL server is Microsoft SQL server 2005.