How to replace null to something.
Moderators: chulett, rschirm, roy
How to replace null to something.
Hi,
I have job where I am reading data from DB2. Now the column I am reading can have null as well. I need to replace that null to "NONE". I did try with CHANGE function but it only works with empty string and not NULL. Is there any inbuilt function or do I need to write custom. Any idea ?
Thanks
V
I have job where I am reading data from DB2. Now the column I am reading can have null as well. I need to replace that null to "NONE". I did try with CHANGE function but it only works with empty string and not NULL. Is there any inbuilt function or do I need to write custom. Any idea ?
Thanks
V
You are wrong. How can a NUll be equal to a Null? A Null is never equal to Null. It's not an integer where you can perform mathematical calculation or comparision.
Use what Ambuj said, "IsNull(column_name) Then .. Else column_name"
or you can use, " if nulltozero(column_name) = 0 then ... Else Column_name2"
You can find the "IsNull" function under: Functions --> Null Handling
IHTH
Use what Ambuj said, "IsNull(column_name) Then .. Else column_name"
or you can use, " if nulltozero(column_name) = 0 then ... Else Column_name2"
You can find the "IsNull" function under: Functions --> Null Handling
IHTH
Raj
Re: How to replace null to something.
Try this :vsanghvi wrote:Hi,
I have job where I am reading data from DB2. Now the column I am reading can have null as well. I need to replace that null to "NONE". I did try with CHANGE function but it only works with empty string and not NULL. Is there any inbuilt function or do I need to write custom. Any idea ?
Thanks
V
If (Len(Trim(Link.Columnname))=0 Or IsNull(Trim(Link.Columnname)) Or Trim(Link.Columnname) ="" ) Then "NONE" Else Trim(Link.Columnname)
it will work
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: