please see ddl below:
create table person (personno int, name varchar, age int,address varchar(100))
is possible select data in following format using single query:
personno name personno age personno address
i need column identify type of row e.g. name. more think more don't think can it. trying pivot.
one option use union all
(just remember convert int
varchar
):
select personno, name value, 'name' type person union select personno, convert(varchar(10), age), 'age' type person union select personno, address, 'address' type person
also please note -- should define length name
field. is, can contain single character.