Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 IS and =

Author  Topic 

smile
Starting Member

22 Posts

Posted - 2009-03-04 : 16:11:31
Hello!

Can someone explain me the difference between the two equality operators - "IS" and "="?

Thanks in advance!

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-03-04 : 18:16:06
quote:
Originally posted by smile

Hello!

Can someone explain me the difference between the two equality operators - "IS" and "="?

Thanks in advance!



"IS" is not an equality operator in SQL Server.

"IS" is a reserved word used in the test for NULL values. Example:
select * from MyTable where MyColumn is null




CODO ERGO SUM
Go to Top of Page

smile
Starting Member

22 Posts

Posted - 2009-03-06 : 06:57:36
Ok, thanks for the reply! :)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-07 : 13:23:16
quote:
Originally posted by smile

Ok, thanks for the reply! :)


and its because NULL is not stored as a value. so comparison operators like =,>,<... will not work with NULL unless you change ANSI NULL settings
Go to Top of Page

smile
Starting Member

22 Posts

Posted - 2009-03-08 : 11:28:16
quote:
Originally posted by visakh16

quote:
Originally posted by smile

Ok, thanks for the reply! :)


and its because NULL is not stored as a value. so comparison operators like =,>,<... will not work with NULL unless you change ANSI NULL settings



Yeah...and the the result of such comparison (with having NULL value) will be unknown, right?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-08 : 12:37:46
yup. thats why it always ignores NULL values
Go to Top of Page
   

- Advertisement -