我'我有这个字符串:
DealerCode = [MAZ3] .AccountID:[4340] .StartDate = [2015-06-01]
select parsename('DealerCode = [MAZ3].AccountID:[4340].StartDate=[2015-06-01]', 1)
依旧给我null。我该如何更改查询以获取点之间的值?
答案 0 :(得分:2)
试试这个:
DECLARE @param NVARCHAR(MAX)
SET @param = 'DealerCode = [MAZ3].AccountID:[4340].StartDate=[2015-06-01]'
SELECT
Split.a.value('.', 'VARCHAR(100)') AS CVS
FROM
(
SELECT CAST ('<M>' + REPLACE(@param, '.', '</M><M>') + '</M>' AS XML) AS CVS
) AS A CROSS APPLY CVS.nodes ('/M') AS Split(a)