_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › Json襦襷り鍵
|
|
2016 伎 覯 json 讌 . 豢 企蟆 襷る . json企 xml企 襦讌 螳.
--一危 襷り鍵 --drop table #temp select N'A' 蠏碁9, N'1' 螳 into #temp union all select N'A' 蠏碁9, N'2' 螳 union all select N'A' 蠏碁9, N'3' 螳 union all select N'B' 蠏碁9, N'100' 螳 go --譟壱 declare @json nvarchar(4000) select @json = isnull(@json, '') + ',' + quotename(蠏碁9, '"') + ':' + '[' + quotename(stuff((select ',' + cast(螳 as nvarchar(4000)) as 'text()' from #temp where a.蠏碁9 = 蠏碁9 for xml path('')),1,1,''), '"') + ']' from (select distinct 蠏碁9 from #temp) a select convert(nvarchar(100), '{' + stuff(@json, 1, 1, '') + '}') json /* 蟆郁骸 json ---------------------------------------------------------------------------------------------------- {"A":["1,2,3"],"B":["100"]} */
鏤
|
蠖 蠍磯ゼ 滑 蠍磯 蠍壱襯 葛. |