Solved

Using conditional split in SCD Type 1 change

Posted on 2013-01-15
6
793 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
  • 3
  • 2
6 Comments
 
LVL 39

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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…
My client sends a request to me that they want me to load data, which will be returned by Web Service APIs, and do some transformation before importing to database. In this article, I will provide an approach to load data with Web Service Task and X…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

778 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