Tricky SQL Server, developer should know

Amatya
Posted by Amatya under Sql Server category on | Points: 40 | Views : 276
Tricky SQL Server, developer should know the concept of 'IS' in SQL Server
select case when null = null then 'True' else 'False' end as Result;

Output: False
False ! The reason is the proper way to compare a value in SQL server is using 'IS' operator and not using '='.

select case when null Is null then 'True' else 'False' end as Result;

Output: True

Thanks
Amatya

Comments or Responses

Login to post response