I would like to "replicate" the excel(data) text to columns function. basically I have a string column, and I would like to split it to multiple columns based on a specific delimiter.
declare @t table (
id int,
name varchar(50)
)
insert into @t values (1,'abcd.ef.g')
insert into @t values (2,'ab.cdef.ghi')
insert into @t values (3,'a..d')
insert into @t values (4,'a')
select * from @t
id name
----------- --------------------------------------------------
1 abcd.ef.g
2 ab.cdef.ghi
3 a..d
4 a
--I would like to get result
id name1 name2 name3
----------- --------------------------------------------------
1 abcd ef g
2 ab cdef ghi
3 a (NULL) d
4 a (NULL) (NULL)
thanks