Thursday 8 February 2018

Pivot SQL

Below is an example of the pivot function in SQL Server. This function can really save time when you need to convert rows to columns. You can Google it but you can create a bit of dynamic SQL in a stored procedure and have a generic function to do this. Can be a bit fiddly though. 

The code:

No comments:

Post a Comment