Solved

SSIS Derived Column

Posted on 2007-03-27
5
1,914 Views
Last Modified: 2013-11-30
Experts:
I have a DTS package that I’m trying to rewrite in SSIS, In my DTS package on one of my transformation were I’m mapping source to destination I have a field that gets populated by a global variable, I use a simple active x script to determine witch variable to use, the script looks like this

Function Main()

If DTSGlobalVariables("i_Max_Skl_Stat_Datetime").Value < DTSGlobalVariables("i_Max_Agt_Stat_Datetime").Value Then

DTSDestination("Data_Datetime") = DTSGlobalVariables("i_Max_Skl_Stat_Datetime").Value

Else

DTSDestination("Data_Datetime") = DTSGlobalVariables("i_Max_Agt_Stat_Datetime").Value

End if
Main = DTSTransformStat_OK
End Function

In SSIS I’m trying to use a Derived Column transformation to accomplish since it has an expression editor but can't see how to use the IF / ELSE logic doesn’t seem to like it, is this not the right transformation to use for this?

Thanks in advance.
0
Comment
Question by:Oneill0003
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:navalarya1982
ID: 18803585
I think sql server 2005 SSIS has a built in support for migrating/upgrating the older version DTS packages to new one.


just explore it and u will be able to find something on it.

Let me know if u dont find anything..

Thanks,
Naval
0
 
LVL 8

Expert Comment

by:drydenhogg
ID: 18803755
Conditional's within a derived column are formatted as:
Boolean Expression ? True part : False part
e.g. IsNull(MyField) ? "" : MyField

0
 

Author Comment

by:Oneill0003
ID: 18804399
drydenhogg: i'm having trouble getting my expression build can you give me a hand with this?

i_Max_Skl_Stat_Datetime < i_Max_Agt_Stat_Datetime ? i_Max_Skl_Stat_Datetime : i_Max_Agt_Stat_Datetime

Thanks guys!
0
 
LVL 8

Accepted Solution

by:
drydenhogg earned 125 total points
ID: 18806727
Assuming they are User Variables the format would be:

@[User::i_Max_Skl_Stat_Datetime] <  @[User::i_Max_Agt_Stat_Datetime ]
?  
@[User::i_Max_Skl_Stat_Datetime ]
:  
@[User::i_Max_Agt_Stat_Datetime]


0
 

Author Comment

by:Oneill0003
ID: 18807774
Thanks drydenhogg, that worked great, i was just missing a few things on my syntax but got it working.!

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

808 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