Convert Single Row into Multiple Rows Via Unpivote
create table tbl_SingleRow
(
col1 varchar(5),
col2 varchar(5),
col3 varchar(5),
col4 varchar(5)
)
insert into tbl_SingleRow values ('aaa', 'bbb', 'ccc', 'ddd')
select A,B FROM tbl_SingleRow
unpivot
(
B for A in (col1, col2, col3, col4)
) MultipleRows
No comments:
Post a Comment