Help

  • Hi

    I want to find out the exact numeric part prom the string. I am using Patindex

    but  the problem is if the Number exists at the very Ist place, it does not work

    select  patindex('%[^0-9]12[^0-9]%','12,13127,12') returns 0

    select  patindex('%[^0-9]12[^0-9]%',' 12,13127,12') returns 1 (The extra space at the begining ) 

    select  patindex('%[^0-9]12[^0-9]%','12,13127,12 ') returns 9 (The extra space at the end &nbsp 

    where as i need 1 with select  patindex('%[^0-9]12[^0-9]%','12,13127,12') 

    Anyone Please

  • Simplest solution:

    select patindex('%[^0-9]12[^0-9]%',' ' + @String + ' ')

    _____________
    Code for TallyGenerator

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

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