SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Matched and Unmatched Rows in ssis 2005


Matched and Unmatched Rows in ssis 2005

Author
Message
sqlstud
sqlstud
SSC-Addicted
SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)

Group: General Forum Members
Points: 463 Visits: 237
Hi,

Need to transfer data from database Db1 (Db1.sampletab1) to database Db2 (Db2.sampletab2) using ssis 2005.

Condition:
If matched data, leave as it is.
If unmatched data, then insert the records into DB2.sampletab2

Is this possible in SSIS 2005? If yes, could you please let me know the steps?


CREATE TABLE [dbo].[sampletab1](
[pKey] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[SasId] [nvarchar](max) NULL,
[Name] [nvarchar](max) NULL,
[TypeId] [nvarchar](max) NULL,
[UserName] [nvarchar](max) NULL,
[CreatedDateTime] [datetime] NULL,
[CompletedDateTime] [datetime] NULL,
[Boolean] [bit] NULL,
)

insert into sampletab1 values('sdf','werwer','s233','xzfdsdf',12/11/2011,14/11/2011,'TRUE')


Regards
SqlStud
rhythmk
rhythmk
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1664 Visits: 1099
sqlstud (10/4/2012)
Hi,

Need to transfer data from database Db1 (Db1.sampletab1) to database Db2 (Db2.sampletab2) using ssis 2005.

Condition:
If matched data, leave as it is.
If unmatched data, then insert the records into DB2.sampletab2

Is this possible in SSIS 2005? If yes, could you please let me know the steps?


CREATE TABLE [dbo].[sampletab1](
[pKey] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[SasId] [nvarchar](max) NULL,
[Name] [nvarchar](max) NULL,
[TypeId] [nvarchar](max) NULL,
[UserName] [nvarchar](max) NULL,
[CreatedDateTime] [datetime] NULL,
[CompletedDateTime] [datetime] NULL,
[Boolean] [bit] NULL,
)

insert into sampletab1 values('sdf','werwer','s233','xzfdsdf',12/11/2011,14/11/2011,'TRUE')


Regards
SqlStud


Very much possible.You can simply handle it by writing except query or you can also use conditional split.

However few query here.
1. How you are recognising new record means what is the unique field.
2. Why are you leaving existing record as in ideal scenario we usually update the old records i.e. genearally we use UPINSERT logic for this type of scenario.

--rhythmk
------------------------------------------------------------------
To post your question use below link

http://www.sqlservercentral.com/articles/Best+Practices/61537/
:-)
sqlstud
sqlstud
SSC-Addicted
SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)SSC-Addicted (463 reputation)

Group: General Forum Members
Points: 463 Visits: 237
Thanks Rhythmk..

I have loaded unmatched data via Erroroutput

Regards
Sqlstud
sqlusers
sqlusers
Mr or Mrs. 500
Mr or Mrs. 500 (547 reputation)Mr or Mrs. 500 (547 reputation)Mr or Mrs. 500 (547 reputation)Mr or Mrs. 500 (547 reputation)Mr or Mrs. 500 (547 reputation)Mr or Mrs. 500 (547 reputation)Mr or Mrs. 500 (547 reputation)Mr or Mrs. 500 (547 reputation)

Group: General Forum Members
Points: 547 Visits: 512
Option - 1: You can make use of LookUp and Condition Split Transformation to achive this.

Option - 2: You can do this by Creating a Procedure.

A. Load all the data's to Staging Table.
B. Create Procedure and load latest data's, by Comparing Staging and Fact table data's and then load the latest data's.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search