Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    Washington D.C.
    Posts
    164

    Unanswered: concatenation Nullfields in T-SQL

    Hi,
    I have a list box for Address which shows available addresses for buildings.
    I want the list box to concatenate the address and show it.
    in Access I used to write :

    Select [address] & " " & [city_] & " " & [state] & " " & [bldgzip] AS [Building Address] From tblAdrs

    This would show the whole thing even if it had some Null fileds (it wouldn't show if I used + instead of &)


    But I don't know why it won't do the same in T-SQL?

    Can anyone help?

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    on most servers Null + <any data type> = Null

    you can disable this feature or use the ISNULL function.

    Select isnull([address],'') + ' '+ isnull([city_],'') + ' '+ isnull([state],'') + ' '+ isnull([bldgzip],'') AS [Building Address] From tblAdrs
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Dec 2002
    Location
    Washington D.C.
    Posts
    164
    Thanks Paul

    Originally posted by Paul Young
    on most servers Null + <any data type> = Null

    you can disable this feature or use the ISNULL function.

    Select isnull([address],'') + ' '+ isnull([city_],'') + ' '+ isnull([state],'') + ' '+ isnull([bldgzip],'') AS [Building Address] From tblAdrs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •