Splitting comma separated values

Kirthiga
Posted by Kirthiga under Sql Server category on | Points: 40 | Views : 706
DECLARE @Keyword TABLE(Keywords varchar(100))
insert into @Keyword values('Chennai ,Bangalore')

select Keywords,substring(Keywords,0,charindex(',',Keywords))Key1
,SUBSTRING(Keywords,charindex(',',Keywords)+1,LEN(Keywords)-charindex(',',Keywords))Key2
from @Keyword

Comments or Responses

Login to post response