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
nnnnn
bc160401882
how-to-assign-a-random-value-in-a-select-statement-in-sqlserver
Crea, inserta y confirma tabla
How to add namespace to sql generated XML output
Mywall
query
SQL_DS_collections
repert
QLCB_CSDL