November 30, 2009 at 10:43 pm
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?
November 30, 2009 at 11:11 pm
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
December 1, 2009 at 3:23 am
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