We are all familiar with seeing our data in a vertical format from SSMS. Here is a sample:

But what if you, or your customer want’s the data horizontally? That is easy enough with a CTE. Here is a quick sample that creates a temp table with some employees and jobs.

Now, the results will look like this:

This probably isn’t the best way to get results in this fashion, but it is certainly quick and easy. Thanks to the guys at SQLServerCentral.com for this one!


Rudy Rodarte is a SQL Server Database professional based in Austin, TX. Over his career, Rudy has worked with SSRS, SSIS, performance tuning troubleshooting. When away from Keyboard, Rudy goes to Spurs and Baylor Bear sporting events.

More Posts - Website - Twitter