dbTalk Databases Forums  

What is wrong with this transformation?

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss What is wrong with this transformation? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Brandon Lilly
 
Posts: n/a

Default What is wrong with this transformation? - 04-18-2006 , 02:45 PM






I am trying to null out a column if it is blank, but get an error in the
derived column transformation. Something about casting operands... but seems
illogical to me...


Column: tax_auth_group DT_STR(10)


Transform: TRIM(tax_auth_group) == "" ? NULL(DT_STR, 10, 1252) :
tax_auth_group


I get the following error:

TITLE: Microsoft Visual Studio
------------------------------

Error at Import Tax Corp Data [Derived Column [862]]: For operands of the
conditional operator, the data type DT_STR is supported only for input
columns and cast operations. The expression "tax_auth_group == "" ?
NULL(DT_STR,10,1252) : tax_auth_group" 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 Import Tax Corp Data [Derived Column [862]]: Attempt to set the
result type of conditional operation "tax_auth_group == "" ?
NULL(DT_STR,10,1252) : tax_auth_group" failed with error code 0xC00470ED.

Error at Import Tax Corp Data [Derived Column [862]]: Computing the
expression "tax_auth_group == "" ? NULL(DT_STR, 10, 1252) : tax_auth_group"
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 Import Tax Corp Data [Derived Column [862]]: The expression
"tax_auth_group == "" ? NULL(DT_STR, 10, 1252) : tax_auth_group" on "input
column "tax_auth_group" (947)" is not valid.

Error at Import Tax Corp Data [Derived Column [862]]: Failed to set property
"Expression" on "input column "tax_auth_group" (947)".



------------------------------
ADDITIONAL INFORMATION:

Exception from HRESULT: 0xC0204006 (Microsoft.SqlServer.DTSPipelineWrap)


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: What is wrong with this transformation? - 04-18-2006 , 03:00 PM






Can you try this instead

TRIM(tax_auth_group) == "" ? NULL(DT_WSTR, 10) : tax_auth_group


--


Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com


"Brandon Lilly" <avarice (AT) nospam_swbell (DOT) net> wrote

Quote:
I am trying to null out a column if it is blank, but get an error in the
derived column transformation. Something about casting operands... but
seems
illogical to me...


Column: tax_auth_group DT_STR(10)


Transform: TRIM(tax_auth_group) == "" ? NULL(DT_STR, 10, 1252) :
tax_auth_group


I get the following error:

TITLE: Microsoft Visual Studio
------------------------------

Error at Import Tax Corp Data [Derived Column [862]]: For operands of the
conditional operator, the data type DT_STR is supported only for input
columns and cast operations. The expression "tax_auth_group == "" ?
NULL(DT_STR,10,1252) : tax_auth_group" 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 Import Tax Corp Data [Derived Column [862]]: Attempt to set the
result type of conditional operation "tax_auth_group == "" ?
NULL(DT_STR,10,1252) : tax_auth_group" failed with error code 0xC00470ED.

Error at Import Tax Corp Data [Derived Column [862]]: Computing the
expression "tax_auth_group == "" ? NULL(DT_STR, 10, 1252) :
tax_auth_group"
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 Import Tax Corp Data [Derived Column [862]]: The expression
"tax_auth_group == "" ? NULL(DT_STR, 10, 1252) : tax_auth_group" on "input
column "tax_auth_group" (947)" is not valid.

Error at Import Tax Corp Data [Derived Column [862]]: Failed to set
property
"Expression" on "input column "tax_auth_group" (947)".



------------------------------
ADDITIONAL INFORMATION:

Exception from HRESULT: 0xC0204006 (Microsoft.SqlServer.DTSPipelineWrap)




Reply With Quote
  #3  
Old   
Brandon Lilly
 
Posts: n/a

Default Re: What is wrong with this transformation? - 04-18-2006 , 03:28 PM



That works, although I am at a loss as to why, since DT_WSTR is different
than the resulting datatype DT_STR. Is this a bug that the ISNULL(DT_STR...)
doesn't work?

Thanks!

Brandon

"Allan Mitchell" wrote:

Quote:
Can you try this instead

TRIM(tax_auth_group) == "" ? NULL(DT_WSTR, 10) : tax_auth_group


Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: What is wrong with this transformation? - 04-18-2006 , 03:40 PM



You can use this type conversion in the conditional expression but the
output datatype can still be DT_STR

--


Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com


"Brandon Lilly" <avarice (AT) nospam_swbell (DOT) net> wrote

Quote:
That works, although I am at a loss as to why, since DT_WSTR is different
than the resulting datatype DT_STR. Is this a bug that the
ISNULL(DT_STR...)
doesn't work?

Thanks!

Brandon

"Allan Mitchell" wrote:

Can you try this instead

TRIM(tax_auth_group) == "" ? NULL(DT_WSTR, 10) : tax_auth_group




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.