I had this question after viewing Syntax error in Stored Procedure...
I am working on converting another MS Access Crosstab/Pivot query to a stored procedure in SQL Server. Here's the SQL code from the Access query:
TRANSFORM Count(q3Treatment.TreatID) AS CountOfTreatID
SELECT q2Course.CoursePatID, q2Course.SiteCity, q3Treatment.CoursePatID, Count(q3Treatment.TreatID) AS [Total Of TreatID]
FROM q2Course LEFT JOIN q3Treatment ON q2Course.CoursePatID = q3Treatment.CoursePatID
GROUP BY q2Course.CoursePatID, q2Course.SiteCity, q3Treatment.CoursePatID
I tried to edit the SP in the question above, but I fail to do it right. Heeeellppp? :-)