find char in column

  • hi,
    column containing alphanumeric data. i won't data from column having first five digit is char.

    PAN_NO
    ACBMX123D6
    AZCM4567G8
    LKM238GG66
    .............
    -----------------------
    OUTPUT IS
    -----------------------
    ACBMX123D6
    -----------------------
    regards
    santosh

    Best Regards
    Santosh Ghogare

  • santoshghogare2008 - Wednesday, May 23, 2018 5:41 AM

    hi,
    column containing alphanumeric data. i won't data from column having first five digit is char.

    PAN_NO
    ACBMX123D6
    AZCM4567G8
    LKM238GG66
    .............
    -----------------------
    OUTPUT IS
    -----------------------
    ACBMX123D6
    -----------------------
    regards
    santosh

    Welcome to SQL Server Central. When posting a question it's helpful to post what you've tried already. If the SQL you've written is almost correct, we can then push you in the right direction. You'll learn much more that way than one of us giving you the answer straight away. 🙂

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Maybe using something like
    WHERE PAN_NO LIKE '[A-Z][A-Z][A-Z][A-Z][A-Z]%'
    You can find more information about searching patterns in here: http://www.sqlservercentral.com/articles/T-SQL/130558/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Try patindex 

    where PATINDEX('%[^A-Z]%',LEFT(PAN_NO,5))=0

    ***The first step is always the hardest *******

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

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