Hi! I used this code. But I have problem who is you can help me?
declare @result int
declare @tbl as table(id int, name varchar(100))
declare @tabl as table(id int, name varchar(100))
insert into @tbl values
(1, 'orange,apple,cherry,melon')
set @result = (select SUM(len(name)-LEN(REPLACE(name,',',''))+1) resust from @tbl)
if @result>1
begin
insert into @tabl(id, name) values(@tbl.id,@tbl.name)
end
first time I run this query it’s must delete orange from @tbl and add into @tabl
like this id=1 name=orange
second time run this query it’s must delete apple from @tbl and add into @tabl
like this id=1 name=orange,apple
every time run it’s must delete one word from @tbl name and add in @tabl name while @tbl name = '' it’s execute task. After four run all name @tbl must delete and add into @tabl name.
How I can solve this?