2016-07-27 33 views

回答

1

您可以使用動態SQL它:

DECLARE @sql nvarchar(max), @cols nvarchar(max) = '[Column1], [Column2]' 

SELECT @sql = 'SELECT * 
FROM SomeTable 
pivot (
Sum(Column1) for [Column2] in ('[email protected]+') 
) AS PVT' 

EXEC(@sql) 
相關問題