Compare NULL Values in MS SQL Server
We can compare null values using below way in SQL server.
In this statement we are comparing employee leave application in Queue, Approved or Declined. When application added in db, if we keep its Status null for "Queue", A for "Approval", D for declined.
So to check how many applications in queue:-
Select count(ApplicationID) from tblEmp where Status is null -It will return all applications in queue
Select count(ApplicationID) from tblEmp where Status='A' - It will return all Approved applications
Select count(ApplicationID) from tblEmp where Status ='D' - It will return all Declined applications
Related Alrticles