Saturday, February 25, 2012

Null value

Hi

I have a database for a credit society which gives loans in that there are 2 fields for a Member table , loan amount taken and guarantor alongwith the other fields like age,address etc .
A person may just be a member and may have not taken any loan yet , so i have kept loan amount as NULL , but when a person takes a loan he must have a guarantor . But if I dont keep the guarantor field as NULL it will cause problem when a person becomes fresh member and has not yet taken loan

Can I keep the guarantor field NULL? Pleez clear out my vague concept about NULLS and help me out

Quote:

Originally Posted by nairdeepthi2000

Hi

I have a database for a credit society which gives loans in that there are 2 fields for a Member table , loan amount taken and guarantor alongwith the other fields like age,address etc .
A person may just be a member and may have not taken any loan yet , so i have kept loan amount as NULL , but when a person takes a loan he must have a guarantor . But if I dont keep the guarantor field as NULL it will cause problem when a person becomes fresh member and has not yet taken loan

Can I keep the guarantor field NULL? Pleez clear out my vague concept about NULLS and help me out


Yes you can have 2 null columns.
But it is better not to for search purposes.
If you don't want to allow nulls you can put 0 in loan column and '' string in guarantor column as default. This way when new record is inserted and these two columns were not mentioned they will insert defaults instead.

But still you have to make sure in your trigger when record is inserted\updated and if loan number is > 0 then guarantor should be not null and > ''

Good Luck.|||Hi

Thank u so much, u were a great help

Quote:

Originally Posted by iburyak

Yes you can have 2 null columns.
But it is better not to for search purposes.
If you don't want to allow nulls you can put 0 in loan column and '' string in guarantor column as default. This way when new record is inserted and these two columns were not mentioned they will insert defaults instead.

But still you have to make sure in your trigger when record is inserted\updated and if loan number is > 0 then guarantor should be not null and > ''

Good Luck.

No comments:

Post a Comment