Display results Horizontally in SQL Server

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. Continue reading “Display results Horizontally in SQL Server”

Using datediff to display results as HH:MM:SS

DateDiff, y u no Pretty?

Sometimes you just need hh:mm:ss

I ran into a case when I needed to display some results in the HH:MM:SS format. We all know and love DATEDIFF, which gives you whole number results. Using DATEDIFF, I was getting results like this:

Continue reading “Using datediff to display results as HH:MM:SS”