?
Solved

Using conditional split in SCD Type 1 change

Posted on 2013-01-15
6
Medium Priority
?
820 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 Patade
[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 1500 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 Patade
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 2

Expert Comment

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

Author Comment

by:Sonali Patade
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 Patade
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

771 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