CREATE TABLE #t(
----[PKID] int primary key identity(101,1),
[iyear] [Nvarchar](4) NOT NULL,
[budget1] [int] NOT NULL,
[budget2] [int] NOT NULL,
[budget3] [int] Not Null
)
GO
INSERT #t
SELECT '2016',100000,12676575,3623232
GO
SELECT * FROM #t
SELECT iyear as 年份,replace(bm,'budget','') as 月份,budget as 预算
FROM #t
UNPIVOT(budget FOR bm IN (budget1,budget2,budget3) ) p
结果: