views:

41

answers:

2

I have table which have columns with values and null values. i need to write a stored procedure to search rows of my table.but these null value columns do not produce an out put...

it gives me a result like this

Type     Value
Int32    0
A: 

You can use...

WHERE
   MyNumberColumn = 10
OR
   MyNumberColumns IS NULL

There are also ways of using default values instead of the null if you need to, for example you could treat all the null values as zero.

Sohnee
+1  A: 

You can always use the ISNULL function:

SELECT
  ISNULL(MyNumberColumn, 0)
FROM  
  Mytable

This will return the actual value in MyNumberColumn - or "0", if the value is indeed NULL.

Marc

marc_s