Det, du ønsker, kaldes UNPIVOT
og gjort sådan:
select id,field,value from
#document_fields
unpivot
(
value
for field in (x,y,z)
) as u
order by id,field
Det, du ønsker, kaldes UNPIVOT
og gjort sådan:
select id,field,value from
#document_fields
unpivot
(
value
for field in (x,y,z)
) as u
order by id,field