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
 Can't select where value is NULL (Ignore)

Author  Topic 

Ziggadebo
Starting Member

20 Posts

Posted - 2011-04-18 : 06:02:39
I hope this is me being stupid, but on the following table, it won't let me select the row where the Tariff_Id is NULL

Tariff_Id T_Type T_TRANS
NULL Charge NULL
File transfer file charge Charge NULL
Gateway annual charge Charge NULL

Why is the following SQL code not returning results

Select * from TARIFFLOOKUP
where Tariff_id = NULL


It should be returing the data in the first row, but instead it returns nothing. I would replace the NULL with a value but cant even select the row given there are no unique variables in that row?

The column is setup as NVARCHAR(255) NULL

Please help?

edited - sorry me being stupid

I used Select * from TARIFFLOOKUP
where Tariff_id is NULL

and works fine, must keep reading the text books!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-04-18 : 06:04:27
[code]
Select * from TARIFFLOOKUP
where Tariff_id IS NULL
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -