I have a string which has values separated by comma.
I need to insert the individual value separated by comma into a table.
I have written following code but values are inserted into the table.
Could any one help me find the mistake in my code.
declare @str varchar(25)
set @str = 'a,b,c'
Create table #Qw(parts varchar(25))
while(patindex(',',@str)>0)
begin
insert into #Qw values(substring(@str,1,1))
end
select * from #Qw
Some issues:
charindexinstead ofpatindex.:
Result: