Search This Blog

Saturday, December 11, 2021

PIVOT Query for static format (value varchar)



--create table tbl_Dummy(ID int identity, ROWID int,VALUE nvarchar(100))
--insert tbl_Dummy values(1,'+')
--insert tbl_Dummy values(2,'IDIB000F508')
--insert tbl_Dummy values(3,'IDIB')
--insert tbl_Dummy values(4,'00F508')
--insert tbl_Dummy values(5,'INDIABANK')
--insert tbl_Dummy values(6,'FARRUKHABAD')

select *
from (select ROWID,VALUE from tbl_Dummy)as s PIVOT(MAX(VALUE) FOR [ROWID] IN ([1], [2],[3],[4],[5],[6]))AS pvt

OUTPUT :





 

No comments :