Re: What is wrong with this transformation?



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@xxxxxxxxxxxxxxxxx> wrote in message
news:1977E785-ECFE-45F6-A081-9258F2E7642C@xxxxxxxxxxxxxxxx
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)



.



Relevant Pages

  • Re: First Program
    ... double compute_mean(int *arr, int arr_length) ... this is one of the few cases where a cast is justified. ... operator takes two operands of the *same* numeric type, ... I might cast both operands: ...
    (comp.lang.c)
  • Re: Is cast operator unary or binary? How many operands?
    ... I'd say one operator, the cast operator, and two operands: ... cast is categorized as an unary operator. ... int i; /* cast i to int, a statement with no effect, or define i in ...
    (comp.lang.c)
  • Re: conditional operator throws exceptions when casting
    ... The type is generated at compile time, and if you have two different types in the result operands for the operator, one needs to be implicitly castable by the compiler to the type of the other, with the type that winds up being suitable for the cast being applied to the whole expression. ... Since the result operands have type "object" and type "Int32", and because Int32 is implicitly castable to object but object is not implicitly castable to Int32, the type of the whole expression is object and the Int32 parameter must be cast to object before evaluating the expression. ... you can resolve the issue by providing an explicit type for the literal by casting it to Int16. ...
    (microsoft.public.dotnet.framework)
  • Re: Sheck this simple programm
    ... Fahd Shariff scribbled the following: ... It's enough to cast *one* of the operands to double. ... But take care not ...
    (comp.lang.java.programmer)