SQL Server Performance

Dynamic Crosstab with multiple pivot columns

Discussion in 'Other SQL Server Blogs around the Web' started by Anonymous, Aug 16, 2007.

  1. Anonymous New Member

    Jeff Smith in his weblog showed how to generate Crosstab reports using a stored procedure. I had a requirement to generate crosstab reports with more than one pivot column. So I used the same approach he used and modified his procedure as shown below CREATE procedure CrossTab ( @select varchar(2000), @PivotCol varchar(100), @Summaries varchar(100), @GroupBy varchar(100), @OtherCols varchar(100) = Null ) AS set nocount on set ansi_warnings off declare @sql varchar(8000) Select @sql = '' Select @OtherCols=...(<a href="http://sqlserver-qa.net/blogs/t-sql/archive/2007/08/16/1338.aspx">read more</a>)<img src="http://sqlserver-qa.net/aggbug.aspx?PostID=1338" width="1" height="1">

Share This Page