replace null with something else

replace null with something else

Post by AJ » Wed, 10 Dec 2003 01:56:10



I want to replace null with something else for a column in a SELECT column, but cannot get the function name. Please help.

Thanks.

 
 
 

replace null with something else

Post by Trey Walpol » Wed, 10 Dec 2003 02:03:02


COALESCE
or
ISNULL


Quote:> I want to replace null with something else for a column in a SELECT

column, but cannot get the function name. Please help.
Quote:

> Thanks.


 
 
 

replace null with something else

Post by BobMcClella » Wed, 10 Dec 2003 02:22:23


Syntax
ISNULL(check_expression, replacement_value)

Arguments
check_expression
Is the expression to be checked for NULL. check_expression can be of any
type.
replacement_value
Is the expression to be returned if check_expression is NULL.
replacement_value must have the same type as check_expresssion.
Return Types
Returns the same type as check_expression.

Remarks
The value of check_expression is returned if it is not NULL; otherwise,
replacement_value is returned.

Examples
A. Use ISNULL with AVG
This example finds the average of the prices of all titles, substituting the
value $10.00 for all NULL entries in the price column of the titles table.

USE pubs
GO
SELECT AVG(ISNULL(price, $10.00))
FROM titles

hth
bob mcclellan


Quote:> I want to replace null with something else for a column in a SELECT

column, but cannot get the function name. Please help.
Quote:

> Thanks.