Page 1 of 1

To Check NULL

Posted: Thu Jul 27, 2006 8:17 am
by Shree0410
How to check if a Filed is null, Is there a IsNull function?

Posted: Thu Jul 27, 2006 8:23 am
by meena
Hi Shree,
Yes, there is a IsNull function.

Posted: Thu Jul 27, 2006 8:27 am
by Shree0410
my requirement is to populate 0000's if the filed is null
I tried If IsNull(myfield) Then 0000, the expression is in red, some syntax error?

Posted: Thu Jul 27, 2006 8:31 am
by Krazykoolrohit
Add else to it.

If IsNull(myfield) Then 0000 Else myfield

Posted: Thu Jul 27, 2006 8:45 am
by meena
Hi Shree..
Use the expression given by KrazyKoolrohit.

Code: Select all

Add else to it. 

If IsNull(myfield) Then 0000 Else myfield 

Posted: Thu Jul 27, 2006 9:53 am
by Shree0410
guys, I am so sorry to post simple ones like this, I have used this many times before and looks like I am getting too dependent on this site at times, just the moment I see a red on the screen, I come here and post it rather than 't h i n k' a while..

Posted: Thu Jul 27, 2006 10:02 am
by meena
Hi Shree..
Do not feel so sorry. This site is to help you and everyone are very cool. I really see DS gurus here.Nothing to feel bad. You will get it by yourself, if not our Gurus are here.
Shree0410 wrote:guys, I am so sorry to post simple ones like this, I have used this many times before and looks like I am getting too dependent on this site at times, just the moment I see a red on the screen, I come here and post it rather than 't h i n k' a while..
All the best..

Posted: Thu Jul 27, 2006 3:28 pm
by ray.wurlod
:idea: If you right-click on a red expression, you can choose "Validate Expression" from the menu, and DataStage will report t you what the parser in the Expression Editor believes is wrong with your syntax.

There is also a Transform called NullToZero that you may prefer to use - though it only gives a single zero. You could apply a Fmt() function to pad that with leading zeroes.