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, ‘‘) + ‘]‘