conditional expression ?
HI THANKS FOR THE REPLY THAT REALY HELPED I AM TRYING ONE MORE CONVERIOSN WHICH AM GETING SINTAX AND TRUNCATION ERRORS THIS IS THE ONE LAST PROBLEM AM HAVING ACTUAL LENTH OF SLASTNAME1 DT_STR IS 25 ... I THINK AM GETING TRUNCATION ERROR AND FAILING THE PACKAGE failed because truncation occurred, and the truncation row disposition on "input column "SLASTNAME1" (1534)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component ([SLASTNAME1]==(DT_STR)''*'')?NULL(DT_STR):SLASTNAME1
July 22nd, 2011 9:09am

That expression doesn't seem like it would result in a truncation error. Is this expression being used in a Derived Column component? Where are the results of this expression going - into an existing column or a new one? If it's an existing column, what data type and length is it? Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 10:58am

SOURCE AND DESTINATION IS SLASTNAME1 DATATYPE DT_STR WITH 25 AS LENGTH I AM USING IT IN A DERIVED COLUMN COMPONENT AND AM REPLACING WITH A EXISTING COLUMN in D C Trans I WANA CHECK IS IF SOURCE HAS JUST * VALUE I NEED TO REPLACE IT WITH NULL
July 22nd, 2011 11:41am

i am trying tocheck date and change it to null tdate == '2999/12/30' ? tdate==null:tdate am using this in derived colmun i am geting syntax errors ..what is the correct syntax .. can any one help me,.. i am missing quoetation marks ?
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 1:49pm

tdate==null is wrong, should be something like NULL(DT_DATETIME) What is datatype of tdate? String or a datetime type? Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
July 22nd, 2011 1:52pm

data type of tdate is db_date
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 1:53pm

data type of tdate is db_date Should be something like this: tdate == '2999-12-30' ? NULL(db_date) : tdate Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
July 22nd, 2011 1:54pm

You don't have to shout. :) Unfortunately, you're not being very clear on what's going on in your data flow. I don't care about the ultimate source or destination of the column, I only care about the metadata of the columns in the expression, and the metadata of the column being altered in the Derived Column. Those two sets of columns (those being "used" and the one being "set") appear to be only one column: SLASTNAME1 - is that correct? The metadata for this column is (DT_STR, 25, 1252)? The expression you're using (or attemting to, I should say) is ([SLASTNAME1]==(DT_STR)''*'')?NULL(DT_STR):SLASTNAME1? If so - that has syntax errors. This should pass a syntax check: ([SLASTNAME1]==''*'') ? NULL(DT_STR, 25, 1252) : [SLASTNAME1] Can you please answer all the questions I asked above, then try the expression I just gave, and let us know what happens? Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 2:55pm

Close - this should work. ([tdate]==(DT_DBDATE)"2999-12-30")?NULL(DT_DBDATE):[tdate] Talk to me now on
July 22nd, 2011 3:17pm

i was never shouting ..sorry for my bad english if that meant as shout ( i was only using capital letters to be visible as i coudnt try html editor) yeah, only one column slastname1 , metadata is dt_str,25,252 i tried your expression , i copied this from derived SLASTNAME1 Replace 'SLASTNAME1' ([SLASTNAME1]==''*'') ? NULL(DT_STR, 25, 1252) : [SLASTNAME1] string [DT_STR] 25 1252 (ANSI - Latin I) TITLE: Microsoft Visual Studio ------------------------------ Error at CHANGE PROCESSING [Derived Column 1 [1486]]: For operands of the conditional operator, the data type DT_STR is supported only for input columns and cast operations. The expression "(SLASTNAME1 == "*") ? NULL(DT_STR,25,1252) : SLASTNAME1" has a DT_STR operand that is not an input column or the result of a cast, and cannot be used with the conditional operation. To perform this operation, the operand needs to be explicitly cast with a cast operator. Error at CHANGE PROCESSING [Derived Column 1 [1486]]: Attempt to set the result type of conditional operation "(SLASTNAME1 == "*") ? NULL(DT_STR,25,1252) : SLASTNAME1" failed with error code 0xC00470ED. Error at CHANGE PROCESSING [Derived Column 1 [1486]]: Computing the expression "([SLASTNAME1]=="*") ? NULL(DT_STR, 25, 1252) : [SLASTNAME1]" failed with error code 0xC00470A0. The expression may have errors, such as divide by zero, that cannot be detected at parse time, or there may be an out-of-memory error. Error at CHANGE PROCESSING [Derived Column 1 [1486]]: The expression "([SLASTNAME1]=="*") ? NULL(DT_STR, 25, 1252) : [SLASTNAME1]" on "input column "SLASTNAME1" (1534)" is not valid. Error at CHANGE PROCESSING [Derived Column 1 [1486]]: Failed to set property "Expression" on "input column "SLASTNAME1" (1534)". ------------------------------ ADDITIONAL INFORMATION: Exception from HRESULT: 0xC0204006 (Microsoft.SqlServer.DTSPipelineWrap) ------------------------------ BUTTONS: OK ------------------------------ thank you for your time and patience .. can you advise me any work around do you think we can do this same task in other way
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 3:30pm

This goes against what I know of expressions... but the following works: (SLASTNAME1 == "*") ? (DT_STR, 25, 1252)NULL(DT_STR, 25, 1252) : SLASTNAME1 I'm really not sure why an explicit cast is necessary - the NULL function is supposed to return exactly what it says it does. I'll be inquiring further... Talk to me now on
July 22nd, 2011 8:16pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics