dbTalk Databases Forums  

SSIS - Error trying to converting the string "(null)" to a null va

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


Discuss SSIS - Error trying to converting the string "(null)" to a null va in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John A
 
Posts: n/a

Default SSIS - Error trying to converting the string "(null)" to a null va - 09-16-2006 , 12:16 PM






Hi all I am trying to convert the string "(null)" in the [PASSWORD] column of
my table to an actual NULL value by using the Derived Column Transformation
tool. I have tried to use two different forms of a conditional operator to
achieve this end. However I am getting the below errors both can be summed
up with the following statement.

DT_STR operand cannot be used with the conditional operation.

The expression directly below however is using a type DT_I4 in the
conditional clause as this is what FINDSTRING returns. So I must say I am
somewhat confused by this. Does anyone know why neither of the below
statements are working?

Also is there an easy way to accomplish what I am trying to do - convert the
string "(null)" in the [PASSWORD] column of my table to an actual NULL value?



FINDSTRING([PASSWORD], "(null)", 1) == 0 ? [PASSWORD] : NULL(DT_STR,
255, 1252)

Error at Administrator Data Flow Task [Derived Column [1985]]: For operands
of the conditional operator, the data type DT_STR is supported only for input
columns and cast operations. The expression "FINDSTRING(PASSWORD,"(null)",1)
== 0 ? PASSWORD : NULL(DT_STR,255,1252)" 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.



LOWER( TRIM( [PASSWORD] ) ) != "(null)" ? [PASSWORD] : NULL(DT_STR,
255, 1252)

Error at Administrator Data Flow Task [Derived Column [1985]]: For operands
of the conditional operator, the data type DT_STR is supported only for input
columns and cast operations. The expression "LOWER(TRIM(PASSWORD)) !=
"(null)" ? PASSWORD : NULL(DT_STR,255,1252)" 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.




--
Thank you,
John

Reply With Quote
  #2  
Old   
Simon Sabin
 
Posts: n/a

Default Re: SSIS - Error trying to converting the string "(null)" to a null va - 09-17-2006 , 03:25 AM






Hello John,
The error is telling you what to do. You need to explicitly cast the NULL
function , even though you state the data type in the NULL function i.e

(DT_STR, 255, 1252)NULL(DT_STR, 255, 1252)



Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons


Quote:
Hi all I am trying to convert the string "(null)" in the [PASSWORD]
column of my table to an actual NULL value by using the Derived Column
Transformation tool. I have tried to use two different forms of a
conditional operator to achieve this end. However I am getting the
below errors both can be summed up with the following statement.

DT_STR operand cannot be used with the conditional operation.

The expression directly below however is using a type DT_I4 in the
conditional clause as this is what FINDSTRING returns. So I must say
I am somewhat confused by this. Does anyone know why neither of the
below statements are working?

Also is there an easy way to accomplish what I am trying to do -
convert the string "(null)" in the [PASSWORD] column of my table to an
actual NULL value?

FINDSTRING([PASSWORD], "(null)", 1) == 0 ? [PASSWORD] :
NULL(DT_STR, 255, 1252)

Error at Administrator Data Flow Task [Derived Column [1985]]: For
operands of the conditional operator, the data type DT_STR is
supported only for input columns and cast operations. The expression
"FINDSTRING(PASSWORD,"(null)",1) == 0 ? PASSWORD :
NULL(DT_STR,255,1252)" 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.

LOWER( TRIM( [PASSWORD] ) ) != "(null)" ? [PASSWORD] :
NULL(DT_STR, 255, 1252)

Error at Administrator Data Flow Task [Derived Column [1985]]: For
operands of the conditional operator, the data type DT_STR is
supported only for input columns and cast operations. The expression
"LOWER(TRIM(PASSWORD)) != "(null)" ? PASSWORD : NULL(DT_STR,255,1252)"
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.




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.