Akalanka
Akalanka

Reputation:

SQL Server 2005 express edition - stored procedure for search my table

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

Upvotes: 0

Views: 144

Answers (2)

marc_s
marc_s

Reputation: 754658

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

Upvotes: 2

Fenton
Fenton

Reputation: 250972

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.

Upvotes: 0

Related Questions