How can i overcome....?

  • Dear all,

    Here I have some authors name here like

    Alok Bhatia

    Amit Chaudhuri

    Amit Varma

    Amitabha Bagchi

    Amitav Ghosh etc..

    Here I have to show in front end..

    Ex: Alok Bhatia => convert to=> Bhatia, Alok

    Can u help me to write this query?

  • Hi,try this

    create table #table

    (

    name1 varchar(20)

    )

    insert into #table

    select 'Alok Bhatia'

    union all

    select 'Amit Chaudhuri'

    union all

    select 'Amit Varma'

    select * from #table

    select PATINDEX('% %',name1) from #table

    select right(name1,(len(name1)-(PATINDEX('% %',name1))))

    +','+

    left(name1,PATINDEX('% %',name1))

    from #table

  • Thanks you so much for your output, Small changes i had working fine,...

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

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