Force a Null

Posted on 2012-08-29
Last Modified: 2012-08-29
I want to force a value in a select statement to be null.

if some column has has anything it, return as a null.
Question by:asullivan62
    1 Comment
    LVL 45

    Accepted Solution

    That's something of a contradiction.  If a column contains data, return null.  Otherwise return null???

    You can always select NULL as any column in the select statement.

      SELECT name, address, NULL as City FROM sometable

    Or did you mean something else?


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Suggested Solutions

    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

    779 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

    14 Experts available now in Live!

    Get 1:1 Help Now