isnull() function is not working for a NULL field

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
rampstage
Participant
Posts: 1
Joined: Tue Feb 12, 2008 10:54 pm
Location: india

isnull() function is not working for a NULL field

Post by rampstage »

My source is fixed width binary file(.txt). For few columns I am getting Blank space from source which is not getting trimmed nor isnull() function is not working on that field. What function i can use to identify this value as i need to populate a default value when there is a space.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

A text file won't contain NULL values and you cannot trim a CHAR column. Either set a column default value or check for empty using a derivation such as 'IF Trim(In.Column)=""' which will create a temporary VarChar as the result of the trim() function. Or check for the correct number of spaces, i.e. check for 10 spaces on a char(10) column.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Re: isnull() function is not working for a NULL field

Post by priyadarshikunal »

rampstage wrote:My source is fixed width binary file(.txt). For few columns I am getting Blank space from source which is not getting trimmed nor isnull() function is not working on that field. What function i can use to identify this value as i need to populate a default value when there is a space.
as ArndW said it doesn't contain null if you want to make it null or the value you want

find its ascii value and then compare it with the ascii value you got

ascii value may be 0 or 32

so compare it like

Code: Select all

if seq(column)=32 then SetNull() else <remaining expression>
if your problem is not resolved try to find the ascii value of that character then use it your code

Search button is also available

try to search the solution before posting



Regards,
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply