get data after the comma - charindex

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prav78
    New Member
    • Oct 2005
    • 1

    get data after the comma - charindex

    hi there
    i have a field name(fil_srt_co nd) with the values of

    cmpnt_name,ASC, 1,2
    cmpnt_stuff,DES C,2,3

    i used the char index:-

    substring(BSSF. fil_srt_cond,ch arindex(BS.colu mn_name,BSSF.fi l_srt_cond) + LEN(BS.column_n ame) +1 ,3) ord,

    substring(BSSF. fil_srt_cond,ch arindex(BS.colu mn_name,BSSF.fi l_srt_cond) + LEN(BS.column_n ame) +5 ,1) len,

    substring(BSSF. fil_srt_cond,ch arindex(BS.colu mn_name,BSSF.fi l_srt_cond) + LEN(BS.column_n ame) +7 ,1) str


    to display them in their specific fields like

    NAME STAR_CHAR LENGTH ORDER
    Tag 1 2 ASC

    however for cmpnt_stuff,DES C,2,3 i'm getting
    NAME STAR_CHAR LENGTH ORDER
    Stuff , , DES

    therefore i'm not getting the required values 2 and 3.
    can u pls help me to find a way how to get the data after the comma. thank you in advance
Working...