Oracle NVL equivalent?  Need to change nulls to a string at the Select line.

Posted on 2005-04-25
Last Modified: 2007-12-19

    I'm looking for a SQL Server equivalent to the NVL oracle pl/SQL statement.  What it does is changes a value to another only if that value is null.  So if it's pulling 3 columns from a database, and the third column has the NVL on it, say with the second parameter "Empty" then any rows that have a null value in that column will return "Empty" for that column rather than a null.  Any ideas?

Question by:gleznov
    LVL 28

    Accepted Solution

    The equivalent of Oracle's NVL is ISNULL.

    SELECT ISNULL(Price, 0)
    LVL 28

    Expert Comment

    As an example:

    SELECT Column1, ISNULL(Column3, Column2)
    FROM YourTable

    Author Comment



    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Join & Write a Comment

    This is my first ever Article on EE or elsewhere; therefore, please bear with me if I have some discrepancies in my writing. I read many articles and questions related to "how to pass values to SSIS packages at run-time?"  Hence, this common ques…
    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now