sql - Why does column = NULL return no rows? -


possible duplicate:
why null = null evaluate false in sql server

if generate query insert data in table "mytab" column --- age, sex, dob, id

insert mytab  values (22, '', '', 4) 

what'll value in column sex & dob ? null ?

if value null ---

 select * mytab  sex=null 

above query gives output ---- no rows selected --- why ??

if value not null ---

 select * mytab  sex null 

above query gives output ---- how ??

null special value in sql denoting absence of data. such, cannot queries like:

select fields table column = null 

null cannot compared anything, including null itself. instead, you'd need:

select fields table column null 

however in case inserting empty value in sex , dob.
, empty value not null. you'd have query for:

select fields table column = '' 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -