Meaning of WHERE x NOT LIKE '% %'

  • In a WHERE clause.

    SELECT

    SCHEMA_NAME([o].[schema_id])

    , [o].[name]

    FROM

    [sys].[objects] [o]

    WHERE

    [o].[type] = 'U'

    AND [o].[name] NOT LIKE '% %'

    I guess I'm having a brain fade, that makes no sense to me. In the query in question removing the AND line doesn't change the result.

  • I've not executed the code but it looks to me like they're trying to reject rows where the name has any spaces.

    --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)

  • Agreed. I guess I’ve just never seen a SQL object with spaces in the name!

  • Unfortunately, I've seen that and more.  I've even seen people add trailing spaces to all of their object names to make it more difficult to use what they've built.  Crazy stuff.

    p.s.  If that's a picture of you in your avatar, nice beard!.  Mine is a touch longer but same shape.  I can store a box of MidRats, a six pack, and a small scooter to get home on in it. 😀  Fun stuff.

    --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)

  • “Security through obscurity.”

    Yep, that’s me. At the longest it’s been another 2”, but i live in Jackson, Wyoming and the beard can collect inconvenient amounts of ice sometimes.

  • ISO standards forbid embedded spaces in the encodings. There's also a set of Unicode characters that have to be used. It's the digits, Latin letters, and a limited set of punctuation marks.

    Please post DDL and follow ANSI/ISO standards when asking for help. 

  • jcelko212 32090 wrote:

    ISO standards forbid embedded spaces in the encodings. There's also a set of Unicode characters that have to be used. It's the digits, Latin letters, and a limited set of punctuation marks.

    Yep... we both get that.  However, Reality <> ISO Standards. 😉

    --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)

  • RichardFRay wrote:

    “Security through obscurity.”

    Yep, that’s me. At the longest it’s been another 2”, but i live in Jackson, Wyoming and the beard can collect inconvenient amounts of ice sometimes.

    I live in South East, Michigan.  It doesn't usually get so cold that we need to bring the iron monkeys into the house but, when it does and the ice collects on the beard, I look at it as free-refrigeration for perishable MidRats. 😀  Heh... and, no... that's not an ISO standard either, Joe. 😀

    --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)

Viewing 8 posts - 1 through 7 (of 7 total)

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