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)
 dynamic crosstab function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-16 : 14:31:47
Judie writes "I'm trying to use the "crosstab" sql code on SQL 7.
It will work with the northwind and pubs examples,
but when I try to use my database I receive an error.

It compiles... but when I run it I get the error.

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ','.


EXECUTE crosstab
'SELECT Course,SC,Title,SUM(TenthDateSeat) as Total
FROM vwCourseEnrollmentByTerm
GROUP BY Term,Course,SC,Title,TenthDateSeat
ORDER BY Course,SC,Term',
'SUM(TenthDateSeat)','Term','vwCourseEnrollmentByTerm'


I've tested the select statement and it works fine.
I'm not sure where to look. I would appreciate any
ideas at all."
   

- Advertisement -