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
 Null values in FK columns

Author  Topic 

wolverine82
Starting Member

5 Posts

Posted - 2010-06-12 : 16:05:35
Hi,

I am trying to execute a query with null values in FK column. When I try to give the condition saying Col_name = Null, the records which contain NULL values are not getting displayed. I know this is not the correct way, but to check I even tried giving 0 and blank, but nothing seems to work.

Can someone help me on this?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-12 : 16:07:56
where Col_name IS NULL instead of Col_name=NULL


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

wolverine82
Starting Member

5 Posts

Posted - 2010-06-12 : 16:19:17
Thanks guys, I used LEFT OUTER JOIN and its working fine now.

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-12 : 16:21:42
Next time please post your query and maybe sample data and wanted result.
It is heavy for us to understand what you are trying to do and what is the problem


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

- Advertisement -