|
The following
T-SQL database script in Query Editor uses recursive CTE to split a CSV list inline fast.
declare @CSV varchar(128)
set @CSV = 'Seattle Steel Structures,720 4th Avenue,,,Kirkland,WA,98233,425-729-5600,425-729-5601';
with cteCSVSplit as
(
select
Element=left(@CSV, charindex(',',@CSV) - 1),
RunningCSV=stuff(@CSV +',',1,charindex(',',@CSV),'')
union all
select convert(varchar(128),left(RunningCSV,
charindex(',',RunningCSV) - 1) ),
stuff(RunningCSV,1,charindex(',',RunningCSV),'')
from cteCSVSplit
where RunningCSV <> ''
)
select Element from cteCSVSplit
go
|