IntroductionHere it is the procedure to Split the words using comma seperator. still you can use different character for split instead of comma(','). Here i m using 'E,l,e,p,h,a,n,t' as word with comma characters. so the output should be 'E','l','e','p','h','a','n','t'. Declare @name as varchar(20)
Declare @i as int
Declare @char as char
Declare @word as varchar(20)
select @name='E,l,e,p,h,a,n,t'
set @word=''
set @i=1
while @i<=len(@name) begin set @char=substring(@name,@i,1) if @char<> ','
begin
set @word=@word+@char
end
else if (@char=',' and @i<>len(@name))
begin
print @word
set @word=''
end
---Print the last word
if @i=len(@name)
begin
print @word
end
set @i=@i+1
end OutputThank you and hope this help. |