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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-02-13 : 08:13:32
|
Nitu writes "Hi I am a newbie to dts.I want to perform the follwing steps in a dts package.1. Connect to ftp server ( I have no problems doing it)2. download file from the ftp server(done this)3. transform data in to an existing table, with following rules: i. check if a similar record exists, then do nothing. ii. if the record exists with the same unique identifier but, some of the fields are not similar, then update the current record by changing one particular field(like date field to capture on which date the record changed), and then insert a new record in to the table. iii. If the record doesnot exist at all, then just insert the new record in to the existing table.Can somebody please give me some ideas and sample code that you have. Thanks a lot in advance,Really appreitiate you help,--Nitu" |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-13 : 08:22:57
|
--Update matched recordsUpdate T1set col=T2.colfrom TargetTable T1 inner join SourceTable T2on T1.keycol=T2.keycol--Insert New recordsInsert into TargetTable (columns)select columns from SourceTable S where not exists(select * from TargetTable where keycol=S.keycol)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|