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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Conditonal transfer of data from excel to sqlserve

Author  Topic 

satish.gorijala
Posting Yak Master

182 Posts

Posted - 2009-03-12 : 09:06:08
Hi, i want to transfer some data from excel file to sqlserver table through DTS package. But the problem is while i transfereing data, is there a way to avoid transfer of duplicates.

Ex: In sqlserver if table contains EmpNo as column and it contains 1,2,6,8 as data. While i transfering data from excel i dont want to transfer the data of empno which already exist in sqlserver.

G. Satish

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-12 : 09:10:22
You can add the LOOKUP dataflow and handle duplicate records there.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-12 : 13:26:29

dump data from excel to staging table and use execute sql task with following query

INSERT INTO SQLTable
SELECT columns...
FROM StagingTable s
LEFT JOIN SQLTable t
ON s.EmpNo=t.EmpNo
WHERE t.EmpNo IS NULL
Go to Top of Page
   

- Advertisement -