1
votes

I have a ragged right file that I am trying to import where I import a NULL where the value is blank. I am importing each row into a column called RowData, then I am parsing that column into various columns. I'm using the following expression to do this:

TRIM((DT_STR,3,1252)SUBSTRING([RowData],1046,3))== "" 
? (DT_STR,3,1252)NULL(DT_STR,3,1252) 
: (DT_STR,3,1252)SUBSTRING([RowData],1046,3)  

For some reason, the data type when I try to do this is a Unicode datatype, which is messing up my import. I am casting both values of the conditional as a non-Unicode. Why is this happening and how can I fix it?

1

1 Answers

0
votes

I found that we need to cast the entire expression as a non-Unicode string.

(DT_STR,3,1252)(TRIM((DT_STR,3,1252)SUBSTRING(RowData,1046,3)) == "" 
? (DT_STR,3,1252)NULL(DT_STR,3,1252) 
: (DT_STR,3,1252)SUBSTRING(RowData,1046,3))