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 |
|
p.shaw3@ukonline.co.uk
Posting Yak Master
103 Posts |
Posted - 2005-10-31 : 15:29:04
|
I have a DTS package that contains a staging table(A) which is to update a working table(B). The Staging table holds bulk data, must first check for duplicate records in the working table and then perform an update. The update must only enter the non-duplicate records. I cannot think how I can perform this. I know it is alot to ask but can anyone please give me some detailed help? Many Thanks. |
|
|
tjforce
Starting Member
8 Posts |
Posted - 2005-10-31 : 16:02:58
|
| It sounds like you are not using an UPDATE but rather you want to INSERT the non duplicated data into the existing table. Change the connection to a sql query something like this:SELECT temptable.field1, etcFROM username.TEMP_TABLE temptableLEFT JOIN username.FINAL_TABLE finaltable ON temptable.samefield = finaltable.samefieldWHERE finaltable.samefield IS NULLThis query will exclude all of the records that are similar in the TEMP_TABLE and the FINAL_TABLE and in the Transformations copy the data from the source to the destination by matching the field names. |
 |
|
|
p.shaw3@ukonline.co.uk
Posting Yak Master
103 Posts |
Posted - 2005-10-31 : 16:26:49
|
| Thanks, guess it's the classic example of trying to think the problem to death and not getting anywhere. I will try your solution when I get into work first thing tomorrow morning. Thanks for your time.Pat. |
 |
|
|
|
|
|