Return Empty Values SSMS

  • I am using SSMS to create Views of data.

    When you add a new field, it only returns records which have data assigned to those fields.

    How do you include records whether they have data assigned to all fields or not?

    For example, from the data below, only Joe and Amy would return in a View consisting

    of NAME, ADDRESS, SOURCE, DESTINATION, as they have

    entries in the 4 named fields.

    Is there a way to show James and Mark too?

    NAMEADDRESS SOURCE DESTINATION

    JoeBloggs Home Office

    AmyBlack Away Office

    JamesGrey Holiday

    MarkBlaine Home

    Regards,

    Gillian

  • I might be over simplifying this, but why can't you do

    SELECT

    Col1,Col2,Col3,Col4

    FROM YourTable

    ?

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.

  • Are you joining to multiple tables? If so you can use outer join (right or left) to select from the table where there might not be data.

  • Thankyou for taking the time to reply.

    I have tried OUTER JOIN and can get it to work to an extent.

    Unfortunately the list I am returning has different groups, say 1,2,3,4 and NULL.

    I want to return results for 1 and NULL, but when I filter for 1, I only get 1.

    I can't figure out how to include the NULLs.

    Hope this makes sense?!

  • Gillian, take some time and read this...

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    then try to ask your question again. Its hard to know how to help you without seeing your object/data structure, and the code you are trying.

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply