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 2005 Forums
 Transact-SQL (2005)
 how do you test for null ??

Author  Topic 

missMac
Posting Yak Master

124 Posts

Posted - 2009-06-18 : 05:05:50
Hello,
whats wrong with this code, am trying to see if a value is null ?

MM

declare @country varchar(max)

set @country = null
if @country = null
begin
print 'I love Sally with all my heart'
end

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-06-18 : 05:06:42
if @country is null



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-06-18 : 05:07:09
if @country is null

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-06-18 : 05:07:27


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-06-18 : 05:08:01
In case of NULL values you should always use IS NULL or IS NOT NULL.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -