sql 拼接json

select ‘[‘ + STUFF((
select top 10
‘,{"carnumber":"‘ + cast(carnumber as varchar) + ‘"‘
+ ‘,"goodsno":"‘ + cast(goodsno as varchar)+ ‘"‘
+ ‘,"goods":"‘ + cast(Goods as varchar) + ‘"‘
+‘}‘
from OtherWeight t1
for xml path(‘‘),type
).value(‘.‘, ‘varchar(max)‘), 1, 1, ‘‘) + ‘]‘

 

 


select ‘[‘ + STUFF((
select top 10
‘,{"carnumber":"‘ + cast(carnumber as varchar) + ‘"‘
+ ‘,"goodsno":"‘ + cast(goodsno as varchar)+ ‘"‘
+ ‘,"goods":"‘ + cast(Goods as varchar) + ‘"‘
+‘}‘
from OtherWeight t1
for xml path(‘‘)
), 1, 1, ‘‘) + ‘]‘

 

sql 拼接json

上一篇:oracle线程杀不掉,强制杀进程


下一篇:富文本框 字段存入数据库