!=NULL and <>NULL in SQLServer 2005 - rg

12-Sep-07 04:10:01
Hello All,

We are planning to migrate SQLServer 2000 databases to SQLServer 2005. In
lot of our code which was written few years before, I see non-standard way of
comparing NULL values such as !=NULL and <>NULL.

In SQLServer 2005, I was wondering if this is supported and if it is not I
have to plan to test all the applications.

Also, are there other things like this, from a programming perspective, that
is not supported.

Thanks,
rgn
button
 
 

!=NULL and <>NULL in SQLServer 2005 - SQL Menace

12-Sep-07 04:32:36
you will need ansi_nulls off, there should be no difference between
2000 and 2005

run this for all the combinations

set ansi_nulls on

if 1 != null
print 1
else
print 0 --0

set ansi_nulls off

if 1 != null
print 1 --1
else
print 0

set ansi_nulls on

if 1 = null
print 1
else
print 0 --0

set ansi_nulls off

if 1 = null
print 1
else
print 0 --0


set ansi_nulls on

if null != null
print 1
else
print 0 --0

set ansi_nulls off

if null != null
print 1
else
print 0 --0

set ansi_nulls on

if null = null
print 1
else
print 0 --0

set ansi_nulls off

if null = null
print 1 --1
else
print 0

set ansi_nulls on



Denis The SQL Menace
http://sqlservercode.blogspot.com
http://sqlblog.com/blogs/denis_gobo/default.aspx
button
 

!=NULL and <>NULL in SQLServer 2005 - Russell Fields

12-Sep-07 04:39:21
rgn,

In regard to other things, run the SQL Server 2005 Upgrade Advisor against
your 2000 databases. It will produce a list of things to be concerned about.
It also has a help file explaining why and suggestions about what to do and
when to do it.

In the SQL Server 2005 Books Online, there are topics such as:
What's New in SQL Server 2005
What's New and Enhanced in Transact-SQL

RLF
button
 

!=NULL and <>NULL in SQLServer 2005 - Tibor Karaszi

12-Sep-07 04:41:30
It might be worth mentioning that SET ANSI_NULLS is deprecated in SQL Server 2008. So at some later
version, we won't be able to revert to the old non-ANSI behavior.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
button
 

!=NULL and <>NULL in SQLServer 2005 - David Portas

12-Sep-07 05:26:56
It is still partially supported provided you set the ANSI_NULLS setting OFF,
but that is not recommended or used by many people any more. Some features,
do not work using ANSI_NULLS OFF so that's another good reason to change
your legacy code.


See Books Online for What's New and Breaking Changes information.

--
David Portas
button
 

!=NULL and <>NULL in SQLServer 2005 - Erland Sommarskog

12-Sep-07 09:13:09
Tibor Karaszi (tibor_please.no.email_karaszi@hotmail.nomail.com) writes:

It's deprecated in SQL 2005 as well.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
button
 
stored proc snippet