Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Creating dynamic columns in the result set based on values in a Lookup table in Project Server using SQL 2008

$
0
0

Hi ,

I have a code that returns the Capacity, Utilization and Availability of resources for a particular time period based on budget type associated with the task assigned to the resource. This Budget Type values come from a lookup table which initially had only 2 standard values i.e. discretionary and non-discretionary.So the existing code gives following result set

ResourceName,Date,Capacity,ActualUtilization,ActualUtilization_Discretionary, ActualUtilization_nonDiscretionary,ActualUtilizationOthers

Now the lookup table can have multiple values apart from the standard ones and I need a query that returns dynamic columns for Utilization based on the other values in BudgetType Lookuptable.Say if BudgetType LT is having extra values like Training,Meeting etc. Result Set should have the below columns also.

Eg. ActualUtilization_Training,ActualUtilization_Meeting

Below is the query for the lookuptable

Bit of Existing Query

In the above query #tbTaskBudgetType ia a temp table that returns TaskUID, ProjectUID and the corresponding BudgetTypes

Can anyone help me with the query to include new columns?  Please let me know for further information.

         


,


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>