Solved

Using conditional split in SCD Type 1 change

Posted on 2013-01-15
6
776 Views
Last Modified: 2016-02-11
Hi,

I am trying to implement SCD T ype1 change using lookup and conditional split in SSIS

I am using lookup and conditional split in my SSIS  package to spilt data between
match and non matched rows.
Non matched rows are inserted into the target table as new rows , while the matched rows are passed through conditional split to check if the source fields is different from target field and if it finds such an entry it updates the target files value with the source value.

source.column != lookup.column

while the above expression does not check for null values in the columns, i use the below expression to handle it if fields are of  integer data type

(isnull(source.column_name) ? 0:source.column_name)) != (isnull(lookup.column_name) ? 0 :lookup.column_name)


for non integer columns(eg:datetime,varchar,text)

i use data conversion to change the datatype to string and then with conditional split i use the below expression to check nulls and unmatched values for the fields

(isnull(source.column_name) ? "" : source.column_name)) != (isnull(lookup.column_name) ? "" :lookup.column_name)

However i am not able to check null values with fields having ntext datat type
I tried converting the datatype to DT Wstr but it does not wrk

Please advise. how to check for null values in the columns with ntext data type
0
Comment
Question by:isonali
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:lcohan
Comment Utility
Did you ever thought about writing your own SQL code insteaqd and use new MERGE functionality? In my opinion this is more open to you and manageable comparing to SSIS.
You could still run it in SSIS sql step obviously

http://technet.microsoft.com/en-us/library/bb510625(v=sql.100).aspx
0
 
LVL 2

Accepted Solution

by:
thatmsftbuguy earned 500 total points
Comment Utility
A Couple of Options

1. You can use the SCD Task in SSIS which will save you quite a few steps in setting up  the split between new records and updating records. It works quite well for SCD-1 changes. I am not a fan of using it for SCD-2 changes due to performance issue.

2. If you want to continue using what you have built, then convert DT_NText is your data conversion task. That datatype is applicable to ntext datatype in SQL Server
0
 

Author Comment

by:isonali
Comment Utility
Well i did use data conversion for ntext column to  use DT_NText and then with the below expression
tried to check for nulls in the source and target  with conditional split but it  it does not work and errors out.

(isnull( new source.column_name) ? "":new source.column_name)) != (isnull(new lookup.column_name) ?"" :new lookup.column_name)

Please advise if the expression needs to be changed for this to work.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 2

Expert Comment

by:thatmsftbuguy
Comment Utility
What Error are you getting. Can you post the error ????
0
 

Author Comment

by:isonali
Comment Utility
Hi.

When i write the expression in the conditional split component it does not parse the condition.
This is the error i get. The column "description" is of type ntext and i have used data conversion to change its type to DT_NText and then then passed the field to conditional split  with the below expression.

(isnull( new source.column_name) ? "":new source.column_name)) != (isnull(new lookup.column_name) ?"" :new lookup.column_name)

Snapshot of the error is attached .

Please advise.

Thanks
error.jpg
0
 

Author Comment

by:isonali
Comment Utility
Oh..k..i think i got it working it does work with ntext datatype and using data conversion, the only thing different i did in the expression in the conditional split was an extra bracket around the expression

(    (isnull( new source.column_name) ? "":new source.column_name)) != (isnull(new lookup.column_name) ?"" :new lookup.column_name)    )
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

My client sends data in an Excel file to me to load them into Staging database. The file contains many sheets that they have same structure. In this article, I would like to share the simple way to load data of multiple sheets by using SSIS.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now