Page 1 of 1

Not Null

Posted: Sat Jul 14, 2007 12:23 am
by m2babaey
Hi
I am not still clear where I should introduce tables feilds Not Null and where not. Can you help me?
thanks

Posted: Sat Jul 14, 2007 7:11 am
by feyd
Basically, you use it on fields you will normally not set initially to make an insertion query smaller and more simple. You have to specify all NOT NULL fields during insertion.

Re: Not Null

Posted: Sat Jul 14, 2007 2:11 pm
by califdon
m2babaey wrote:I am not still clear where I should introduce tables feilds Not Null and where not. Can you help me?
In most situations you should not use NOT NULL unless the field is one that you want to make absolutely certain contains data in every record. A primary key is an obvious example, but also for fields which, if blank, make the data useless, such as LastName in a directory of people. Using it anywhere else raises the potential that at some point you will want to enter a record that has no data in the field (perhaps expecting to fill it in later) and your database will refuse to allow you to enter the record. Believe me, it happens all the time.