Re: Null values

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 08/17/04


Date: Wed, 18 Aug 2004 00:39:42 +0200

On Tue, 17 Aug 2004 15:24:44 -0700, Loretta wrote:

>How can I replace null value of a column in a query
>with something like 'TEST'
>
>for eg. if I run the query
>select contract_num, prodid from product
>
>if the contract_num is null, it should return 'TEST'
>instead of NULL. how can I do so?
>
>Thank you,
>-Loretta

Hi Loretta,

SELECT COALESCE(contract_num, 'TEST')

Best, Hugo

-- 
(Remove _NO_ and _SPAM_ to get my e-mail address)


Relevant Pages

  • Re: Derived tables
    ... >the same query 2 times, ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.programming)
  • Re: Need a query
    ... >I need a query to get the following data set: ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.programming)
  • Re: Reuse Calculated fields in Select Queries
    ... >Say I have this example select query. ... I'd really hate to have to repeat my calculation each time I'd like to reuse it. ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.programming)
  • Re: Join Problems
    ... >The following query has failed to return all the records. ... >As per right outerjoin in the above statement I suppose to get all the ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.clients)
  • Re: calculate cummulative or store it
    ... >have a predefined query which does the cummulative. ... >takes time to do the calculation. ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.programming)