Solved

Using conditional split in SCD Type 1 change

Posted on 2013-01-15
6
812 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:Sonali Paradkar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 38782796
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
ID: 38784192
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:Sonali Paradkar
ID: 38784505
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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 2

Expert Comment

by:thatmsftbuguy
ID: 38784734
What Error are you getting. Can you post the error ????
0
 

Author Comment

by:Sonali Paradkar
ID: 38784882
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:Sonali Paradkar
ID: 38784960
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 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