Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kkiranvr
Yak Posting Veteran
54 Posts |
Posted - 2009-05-05 : 18:56:20
|
| i need to insert record into a table if that record is not existing in the table.Ex: Table name is "Testing" and having the column as Col1 and it is holding values as shown below.Col18910v51Now i am having a flat file and values are8 Value is repeating(So i dont want to insert it)1110 Value is repeating(So i dont want to insert it)1516i want to insert records into the table "Testing" asCol18910v51111516Thanks-Thanks N Regards,Chinna. |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-05-05 : 19:12:08
|
| bcp the file to a staging table. Insert from there using "where not exists"..insert into testingselect * from tab_stg where not exists (select * from testing where col1=tab_stg.col1) |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-05-05 : 22:43:56
|
| insert into testingselect * from flat f left join testing t on t.col1 = f.col1where t.col1 is null |
 |
|
|
|
|
|