Tuesday, August 02, 2011

RogerNoble.com

RogerNoble.com: "I needed to un-pivot the values for each month in order to be able to map it to the actual days in the month so I can have a count measure. In addition I also needed to duplicate each row twice as each also represented an ‘In’ and an ‘Out’ transaction. At first glance it would seem that the simple solution calls for some sort of cursor, but having recently seen Jeff Moden’s talk on Numbers Tables at the SQL PASS Summit 2010 I decided instead to solve it using a numbers table but also apply the same logic to the date dimension table that was already in the warehouse. (Jeff has written a great post here: http://www.sqlservercentral.com/articles/T-SQL/62867/ which pretty much covers what he talked about)"

Interesting approach to using CROSS APPLY and a numbers table to distribute and pivot budget data.

1 comment:

Rudra455 said...
This comment has been removed by a blog administrator.