Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Another crosstab question

Author  Topic 

vmon
Yak Posting Veteran

63 Posts

Posted - 2003-05-28 : 08:25:07
Don't want to be a pest but I am so close. I am starting to understand the Execute statement construction and have not tried to understand the crosstab sproc yet.

My crosstab is working except for the order of the columns. I want to sort the columns on the pivot value which happens to be a date. Do I need to Declare a new variable for the ORDER BY and make changes to the crosstab sproc or do I just put it on the end of the execute. My calling statement in below.

SET @WHERE = ' DATE_CALC = ''' + CONVERT(varchar(8),@txtCurrent,1)+''' AND DATE_BUCKET >= ''' + CONVERT(varchar(8),(DATEADD(m,-12,@txtCurrent)-DATEPART(d,@txtCurrent)+1),1)+''''

EXECUTE crosstab 'SELECT Caseworker FROM tblWeeklyAging GROUP BY Caseworker', ' SUM(Amount)', ' CONVERT(varchar(8),Date_Bucket,1) ORDER BY DATE_BUCKET ', ' tblWeeklyAging ', @WHERE

thanks for all your help,
vmon

   

- Advertisement -