Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
JSON with No root node - Format from XML output - SQL
create table #temp(cid int, name varchar(10),age int, volunteer bit, address varchar(20)) insert into #temp values (1001,'Jack',25,1,'test address1'), (1002,'Brandy',34,0,'test address2'), (1003,'Vincent',14,0,'test address3'), (1004,'Rado',35,1,'test address4') select * from #temp create table #finaldata(cid int,xml_data xml) insert into #finaldata select t.cid, Final = ( select t1.cid, t1.name, t1.age, t1.volunteer, t1.address from #temp t1 where t1.cid = t.cid for xml path('Final'),type) from #temp t select * from #finaldata drop table #temp,#finaldata
run
|
edit
|
history
|
help
0
Q2_30min
Miercoles
Caronas
a
self join
aawrish
see a quell
#Temp table Collation fixed
Return a single column that matches a parameter
SQL Problem Template