SSIS Derived Column Expression Error /working with Dates
I have an SQL database with the fields coming in form the database as date, time, and datetime. In certain instances, the datetime column is null. when I encounter that case, I want to create a derived column containing the data in datetime format.
I started out be running the data directly through the derived task and got errors.
Then, I rand the data through a Data Conversion task and changed the incoming data:
in_date -> DT_DBDATE
in_time -> DT_DBTIME
in_dttm - DT_TIMESTAMP
I tried various versions of the following expression: ISNULL(in_dttm)?DT_TIMESTAMP(in_date+in_time):DT_TIMESTAMP(in_dttm)
This produces errors: 0CxC004708A
I have massaged this several ways and have yet to get the right combination.
Can anyone help me on this one?
Thanks in advance,
pencarver
John Stires
September 30th, 2012 2:41pm
Pencarver,
When you encounter a case where the datetime is NULL you want to capture the value in a derived column? How, if the value is NULL what are you capturing? Can you add the full error message you're getting?
Thanks,Francis, MCTS: BI 2008, MCITP: BI 2008 Stay Thirsty My Friends
Free Windows Admin Tool Kit Click here and download it now
September 30th, 2012 2:52pm
There are 3 fileds, in_date, in_time, and
in_datetime. The in_date and the in_time fileds will always be populated. The issue is that if the
in_datetime fields is null, I need to populate it with the date and time from the other 2 fields. Hence, the check for the
null in the in_datetime field. Then if the
in_datetime field is not null, all is good, I just put that value into my derived field. If the
in_datetime field is null, I want to combine the
in_date and the in_time fields to create the value
in_datetime in datetime format. Later on, I will using this field to calculate time differences with several other datetime fields.
There are 4 errors on this:
1)[1644]The function DT_TIMESTAMPwas not recognized. Either the function name is incorrector does not exist.
2)[1644]Attempt to parse the expression ... failed and returned error code 0xC004708A. The expression cannot be parsed.
3)[1644]Cannot parse the expression ... the expression was not valid, or there was an out-of-memory error.
4)Failed to set property "Expression" on "output columnim_datetime (2619)
Note: ( ... is where the error message included the espresion itself in quotes.)
Additional informaion: Exceptionfrom HRESULT:0xC0406006 (Microsoft.SQLServer.DTSPipelineWrap)
When I get this task working, I will have a very similar operation to do a number of times through several other tables which why I need to get this one working.
ThanksJohn Stires
September 30th, 2012 6:19pm