0
SELECT * 
FROM [dbo].[drugTP] 
WHERE [DrugRate] IS NULL 

enter image description here

When I run this query, SQL Server returns an empty grid, why?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Hakawati
  • 1
  • 3
  • 3
    are your values null or empty strings? – CollinD Mar 22 '17 at 02:58
  • A value of NULL indicates that the value is unknown. A value of NULL is different from an empty or zero value. No two null values are equal. Comparisons between two null values, or between a NULL and any other value, return unknown because the value of each NULL is unknown – Hua Trung Mar 22 '17 at 03:05
  • I think values are empty. so how can i handle it – Hakawati Mar 22 '17 at 03:45
  • 1
    You Need to Read [How to Ask a Query on Stack-overflow](https://stackoverflow.com/help/how-to-ask) – Prasad Mar 22 '17 at 03:50
  • Possible duplicate of [How do I check if a Sql server string is null or empty](http://stackoverflow.com/questions/334108/how-do-i-check-if-a-sql-server-string-is-null-or-empty) – CollinD Mar 22 '17 at 14:21

1 Answers1

0

Probably the value in the column is not a "NULL" value but an empty string.

You can try matching the empty string

SELECT * 
FROM [dbo].[drugTP] 
WHERE [DrugRate] IS NULL or [DrugRate] = ''

or using the function NULLIF, that returns NULL if the two parameters are equal

SELECT * 
FROM [dbo].[drugTP] 
WHERE NULLIF([DrugRate],'') IS NULL
lebenf
  • 998
  • 6
  • 4