Here 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 ',' 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 Output of this query would be,
it's cool
ReplyDelete