I want split text from NAME column and insert comma separated data to PARCA column for each row. ex:
name parca
---- -------------
john j,jo,joh,john
Code:
DECLARE @i int = 0
WHILE @i < 8
BEGIN
SET @i = @i + 1
update export1 set PARCA = cast ( PARCA as nvarchar(max)) + cast (substring(NAME,1,@i) as nvarchar(max) ) +','
FROM export1
end
There are two things I can't do;
- I could not equalize the @i value to name row count
- I could not checked NAME column whether the value in PARCA column