Page 1 of 2

Inserting NULL records even after defining constraint

Posted: Fri Feb 22, 2008 4:04 am
by PRIYARAJ
Hi,

I am reading a data from a file which has "~" as a delimiter.I am writing to a table.There is column PHONE from source where I have check for null value.I should insert the data only when PHONE is not null.

So I defined a stage variable with condition If IsNull(LK1.PHONE) Then 'N" Else 'Y'.

The constraint I give is StageVar='Y'.Even after defining the constraint,null records are getting populated.Is there any way that I can do this?
But,where the PHONE is null in file holds the data like this :

N-0402~~N~Y~CTR

If there is a value for PHONE then the data look like :

N-7501~462323696~Y~N~CTR

Posted: Fri Feb 22, 2008 4:18 am
by ArndW
Please remember that an empty string, "", is not null.

Posted: Fri Feb 22, 2008 4:29 am
by PRIYARAJ
Thanks for your response.

So should I have to give If LK1.PHONE="" Then 'N' Else 'Y' condition?

Thanks again

Posted: Fri Feb 22, 2008 4:29 am
by PRIYARAJ
Thanks for your response.

So should I have to give If LK1.PHONE="" Then 'N' Else 'Y' condition?

Thanks again

Posted: Fri Feb 22, 2008 4:40 am
by WoMaWil
Concerning telefonnumbers some remarks:

(1) you should check more than "Null" perhaps if at least one number is in it.

(2) There are a lot of formats which differ from region to region in the world.

(3) In some countries and among countries telephone numbers have a different length

(4) Best is to use the international standardize way for numbers like +33-1-2345-3456 for a number in Paris

Posted: Fri Feb 22, 2008 4:55 am
by PRIYARAJ
Thanks a lot !

I will fix it & let you know if I have any issues.

Posted: Fri Feb 22, 2008 5:19 am
by SHARAD123
Hi priyaraj,

Y don you try a much simpler solution....

There is no need to use stage variables for this functionality.
Instead check condition in the constraint for the link.

Use this constraint:
not(isnull(required link) )

Posted: Fri Feb 22, 2008 5:22 am
by PRIYARAJ
Thanks .

I will try the code which you have sent & let you know .

Thanks again

Posted: Fri Feb 22, 2008 5:30 am
by PRIYARAJ
SHARAD123 wrote:Hi priyaraj,

Y don you try a much simpler solution....

There is no need to use stage variables for this functionality.
Instead check condition in the constraint for the link.

Use this constraint:
not(isnull(required link) )

Sharad,

I tried using the constraint which You sent ,but it still inserts all the data.Its because of empty string?

Posted: Fri Feb 22, 2008 6:24 am
by ArndW
SHARAD123 wrote:Hi priyaraj,

Y don you try a much simpler solution....

There is no need to use stage variables for this functionality.
Instead check condition in the constraint for the link.

Use this constraint:
not(isnull(required link) )
You won't be getting NULLs from a text file. The constraint should be

Code: Select all

Trim(In.ColumnName)#''

Posted: Fri Feb 22, 2008 6:35 am
by PRIYARAJ
Hi ARVD,


I cannot see your eply as I am not a premium member.Thanks!

Posted: Fri Feb 22, 2008 6:40 am
by ArndW
No problem, Priyaraj. Someone else might post a non-premium response that will help you soon.

Posted: Fri Feb 22, 2008 7:16 am
by chulett
ArndW wrote:Please remember that an empty string, "", is not null.

Posted: Fri Feb 22, 2008 7:42 am
by ray.wurlod
Premium membership is not expensive; it's less than 30c (Rs12) per day. Revenue from premium memberships is totally devoted to helping to defray the hosting and bandwidth costs incurred by DSXchange. And you get to be able to read the entire contents of premium posters' contributions, among other benefits.

Posted: Fri Feb 22, 2008 7:51 am
by PRIYARAJ
Thanks for your information.I will buy Premium membership if its only 30c per day.Thanks again