试试下面的脚本。
DECLARE @data VARCHAR(Max) = 'nt:865067021846160;2;8.5.05;1,1,20161010102239.000,18.580423,73.815948,549.700,0.28,33.6,11;101;100;0;0;0;FF;146;25}'
DECLARE @SpitChars varchar(100) = '%[:;-]%'
;WITH cte_1
AS
(
SELECT PATINDEX(@SpitChars, @data) - 1 + case when PATINDEX(@SpitChars, Left(@data,1)) = 1 then 1 else 0 end AS LineBreaker
, @data AS dataString
,SUBSTRING(@data, 1, ISNULL(NULLIF(PATINDEX(@SpitChars, @data), 0) - 1 +case when PATINDEX(@SpitChars, Left(@data,1)) = 1 then 1 else 0 end, 8000)) AS [Extract]
UNION ALL
SELECT LineBreaker + ISNULL(NULLIF(PATINDEX(@SpitChars, SUBSTRING(dataString, LineBreaker+1 , 8000)), 0) - case when PATINDEX(@SpitChars, SUBSTRING(dataString, LineBreaker+1 , 8000)) = 1 then 0 else 1 end ,datalength(dataString)-LineBreaker) LineBreaker
, dataString
,SUBSTRING(dataString, LineBreaker+ 1 , ISNULL(NULLIF(PATINDEX(@SpitChars, SUBSTRING(dataString, LineBreaker+1 , 8000)), 0) - case when PATINDEX(@SpitChars, SUBSTRING(dataString, LineBreaker+1 , 8000)) = 1 then 0 else 1 end ,datalength(dataString)-LineBreaker)) AS [Extract]
FROM cte_1
WHERE LineBreaker BETWEEN 1 AND datalength(@data)-1
)
SELECT [1] Col1,[2] Col2,[3] Col3,[4] Col4,[5] Col5
,[6] Col6,[7] Col7,[8] Col8,[9] Col9,[10] Col10
,[11] Col11,[12] Col12,[13] Col13
FROM(
SELECT [Extract],ROW_NUMBER()OVER( ORDER BY (SELECT 1))RNO
FROM cte_1
WHERE [Extract] NOT IN (':',';','-'))t
PIVOT(MAX([Extract]) FOR [RNO] IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13]) )as pvt