Null value in table

  • Hi,

    I want to concatenate fields from a table into a combo box. I entered the following SQL Select statement:

    SelectCommand="SELECT Project + ' ' + Task + ' ' + [Sub Task] + ' ' + Description AS RAS FROM RAS_Codes">

    The [Sub Task] field has empty rows and when the query returns the results it omits all of the rows in which [Sub Task] is empty.

    How do I get the query to return all of the rows - even those with no values in fields?

    Thank you,

    John

  • inliten (7/23/2009)


    Hi,

    I want to concatenate fields from a table into a combo box. I entered the following SQL Select statement:

    SelectCommand="SELECT Project + ' ' + Task + ' ' + [Sub Task] + ' ' + Description AS RAS FROM RAS_Codes">

    The [Sub Task] field has empty rows and when the query returns the results it omits all of the rows in which [Sub Task] is empty.

    How do I get the query to return all of the rows - even those with no values in fields?

    Thank you,

    John

    SelectCommand="SELECT Project + ' ' + Task + ' ' + isnull([Sub Task],'') + ' ' + Description AS RAS FROM RAS_Codes">

  • Duplicate post also answered at the following...

    http://www.sqlservercentral.com/Forums/Topic758447-9-1.aspx#bm758462

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Ms. Pettis,

    Thank you very much for your reply. I did the following and it works fine.

    SelectCommand="SELECT Project + ' - ' + Task + ' - ' + Iif(isnull(SubTask),' (No Sub Task) ',SubTask) + ' - ' + Description AS RAS FROM RAS_Codes">

    John

  • Mr. Moden,

    Thank you very much. I did the following.

    SelectCommand="SELECT Project + ' - ' + Task + ' - ' + Iif(isnull(SubTask),' (No Sub Task) ',SubTask) + ' - ' + Description AS RAS FROM RAS_Codes">

    John

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

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