I have a simple table containing Student Numbers and corresponding Teacher Numbers, and I need to denormalize it for input to a legacy system.
For example, here\'s
I second PIVOT.
Here are two interesting links with programmatic solutions to dynamic crosstab data in SQL.
http://www.simple-talk.com/sql/t-sql-programming/creating-cross-tab-queries-and-pivot-tables-in-sql/
http://www.simple-talk.com/sql/t-sql-programming/crosstab-pivot-table-workbench/