how to deal with characters and period

  • Hi,

    I am new to SQL so I need help writing a query from a table that only contains data with spacing or period in between and has at least 5 characters or more. This is the actual data:

    GMT PR

    BA UNS

    MRLBV.S

    XDNS.AFC

    Please help.

  • Okay, that's your data, but what does the table look like, what is the output from the query supposed to look like?

  • I'm not clear on what you're asking.

    Do you need to do something beyond just query that column of data from the table?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Sorry for being unclear, the table contains ticker from exchanges like NYSE or Nasdaq and their format are different as you can see below it has different format. What I want to do is run a query that pulls only the ticker with space or period in between the names (eg BAC PRE and

    BRKAX.A) that also have 5 characters or more including the period and the space. Hopefully, this is clear enough? Thanks.

    ISIN Ticker

    US0079422046ADVNB

    US0320151097AMPL

    US0376041051APOL

    US0397621097ARDNA

    US0605058157BAC PRE

    CA0641491075BNS

    US0820472001BNHNA

    US0846701086BRKAX.A

  • Something like this?

    select

    ISIN,

    Ticker

    from

    #TestTab

    where

    len(Ticker) >=5

    and (Ticker like '% %' or Ticker like '%.%');

  • This works for me. Thanks, Lynn.

Viewing 6 posts - 1 through 6 (of 6 total)

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