Pivot Table

Can I use the SQL from Access below exactly the same in a stored Proc?  I do not have access to test in SQL Server right now.

TRANSFORM Count(AllStat.Position) AS CountOfPosition
SELECT AllStat.[Position Status]
FROM AllStat
GROUP BY AllStat.[Position Status]
PIVOT AllStat.Age;
LiCannAsked:
Who is Participating?
 
dqmqConnect With a Mentor Commented:
Furthermore, TSQL does not have anything equivalent to the PIVOT clause, which determines column headings from a data column.  TSQL has a PIVOT statment, but it requires hardcoded column headings.   However, you can emulate the TRANSFORM functionality by using dynamic SQL to construct a SELECT statement with a PIVOT clause.

If you search for "dynamic pivot" in this forum you will find examples.




0
 
dqmqCommented:
>Can I use the SQL from Access below exactly the same in a stored Proc?

No, that syntax is not valid in TSQL

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.