Why I am seeing NULL value in a table where the schema defines as NOT NULL field? So I am checking a friend's project. I got a table where every field is defined will NOT NULL constraint but I am still finding so many fields are NULL. I cannot understand what might be the reason to happen this kind of phenomenon? 

Because as I have understanding if you pass NULL value in a field which is defined as NOT NULL than it does not let you submit that entry. 




Thank you.

P.S. This is a very big, perfectly working pharmacy management system.
Are you sure those "empty" cells are set to NULL?

It could be that they have inserted empty strings to get past the Not Null restriction. Code like this will bypass a Not Null setting:

INSERT INTO &lt;table&gt; (Pat_LNAME, Pat FmName, Pat_email) values ('', ' ', '  ');


Notice, in the LNAME field, I pass an empty string '' (two single quote marks). In the second, I pass in a space, ' '. In the third I pass two spaces '  '. All three will get past a NOT NULL rule.

But this code WOULD fail:

INSERT INTO &lt;table&gt; (Pat_LNAME, Pat FmName, Pat_email) values (null, ' ', '  ');


Or any insert that didn't have a Pat_lname field included. 

In SQL Server Management Studio, your view would show you Null columns like this:



Note the yellow background and the word NULL to show there's no data.

Remember, NULL does not equal empty string.