how to select values having spaces

  • HI

    I have values like this:

    10003 3434

    34ADF 0002

    123FR23234 3434

    1232434

    df3434

    342346

    Now my question is how do i select the values that have spaces like in the above 3 values.

    Thanks

  • DECLARE @t TABLE (testData VARCHAR(50))

    INSERT @t

    SELECT 'ghghgh ghghgh ghghg' UNION ALL

    SELECT 'ghghgh ghghxxxhghg' UNION ALL

    SELECT 'ghghgxhghg' UNION ALL

    SELECT 'ghghghghghgh ghghg'UNION ALL

    SELECT 'ghghghghghghhghg '

    SELECT * FROM @t WHERE CHARINDEX(' ',testData) >0

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • Try using LIKE, perhaps as follows:

    SELECT DATA_VALUE

    FROM MY_TABLE

    WHERE DATA_VALUE LIKE '% %'

    Note there is a single space between the two percent signs.

    Steve

    (aka smunson)

    :):):)

    want_to_know (6/3/2008)


    HI

    I have values like this:

    10003 3434

    34ADF 0002

    123FR23234 3434

    1232434

    df3434

    342346

    Now my question is how do i select the values that have spaces like in the above 3 values.

    Thanks

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Thank you guys

    I tried the Like operator and it worked

    Thanks to you all

    God Bless

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

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