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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 IF condition

Author  Topic 

eddyuk
Starting Member

4 Posts

Posted - 2009-03-09 : 11:41:30
Hello.

Recentley i runned into a strange formed condition looks like that:

IF NOT @ID = null BEGIN ...

Can someone please explain to me what that means?... Logicly it dosen't make sence to me, and how it's different from:

IF @ID IS NOT null BEGIN ...

Thanks in advanced.

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-03-09 : 13:20:08
I think IF NOT is the converse of IF.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-10 : 04:53:50
quote:
Originally posted by eddyuk

Hello.

Recentley i runned into a strange formed condition looks like that:

IF NOT @ID = null BEGIN ...

Can someone please explain to me what that means?... Logicly it dosen't make sence to me, and how it's different from:

IF @ID IS NOT null BEGIN ...

Thanks in advanced.



they both are same. first case it check if @ID is null value and if its false then NOT returns true and statements inside if will be executed.
in second case we're directly checking if value is not null and then executing other statements
In first case, for condition to work you need to set ANSI NULL setting to OFF else =NULL will always be false.
Go to Top of Page
   

- Advertisement -