SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007

Can you please help me to write an SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007. Thanks!!

Refer
http://gallery.technet.microsoft.com/projectserver/Server-20072010-SQL-Get-a99d4bc6
SELECT
dbo.MSP_EpmAssignment_UserView.ProjectUID,
dbo.MSP_EpmAssignment_UserView.TaskUID,
dbo.MSP_EpmProject_UserView.ProjectName,
dbo.MSP_EpmTask_UserView.TaskName,
dbo.MSP_EpmAssignment_UserView.ResourceUID,
dbo.MSP_EpmResource_UserView.ResourceName,
dbo.MSP_EpmResource_UserView.ResourceInitials
INTO #TempTable
FROM dbo.MSP_EpmAssignment_UserView INNER JOIN
dbo.MSP_EpmProject_UserView ON dbo.MSP_EpmAssignment_UserView.ProjectUID = dbo.MSP_EpmProject_UserView.ProjectUID INNER JOIN
dbo.MSP_EpmTask_UserView ON dbo.MSP_EpmAssignment_UserView.TaskUID = dbo.MSP_EpmTask_UserView.TaskUID INNER JOIN
dbo.MSP_EpmResource_UserView ON dbo.MSP_EpmAssignment_UserView.ResourceUID = dbo.MSP_EpmResource_UserView.ResourceUID
SELECT
ProjectUID,
TaskUID,
ProjectName,
TaskName,
STUFF((
SELECT ', ' + ResourceInitials
FROM #TempTable
WHERE (TaskUID = Results.TaskUID)
FOR XML PATH (''))
,1,2,'') AS ResourceInitialsCombined,
STUFF((
SELECT ', ' + ResourceName
FROM #TempTable
WHERE (TaskUID = Results.TaskUID)
FOR XML PATH (''))
,1,2,'') AS ResourceNameCombined
FROM #TempTable Results
GROUP BY TaskUID,ProjectUID,ProjectName,TaskName
DROP TABLE #TempTable
-Prashanth

Similar Messages

  • SQL Query to get All AD Groups and its users in Active Directory

    Hi,
       Is there any query to get all AD groups and its user in an instance of a SQL server?

    Check this blog.
    http://www.mikefal.net/2011/04/18/monday-scripts-%E2%80%93-xp_logininfo/
    It will give you more than what is required. If you dont want the extra information,then you can try this.. I took the query and removed the bits that you might not require.
    declare @winlogins table
    (acct_name sysname,
    acct_type varchar(10),
    act_priv varchar(10),
    login_name sysname,
    perm_path sysname)
    declare @group sysname
    declare recscan cursor for
    select name from sys.server_principals
    where type = 'G' and name not like 'NT%'
    open recscan
    fetch next from recscan into @group
    while @@FETCH_STATUS = 0
    begin
    insert into @winlogins
    exec xp_logininfo @group,'members'
    fetch next from recscan into @group
    end
    close recscan
    deallocate recscan
    select
    u.name,
    u.type_desc,
    wl.login_name,
    wl.acct_type
    from sys.server_principals u
    inner join @winlogins wl on u.name = wl.perm_path
    where u.type = 'G'
    order by u.name,wl.login_name
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Sql query to get distinct count

    Hi
    I use SQL Server Management Studio
    can I have a sql query to get count as shown below against  each month column and name column to get distinct count.
    for example if there is two rows with the same date period and same name then the count should be one in first row and zero in the next row of the same data.
    Table Name: Table1
    Column: Month, Name
    Month
    Name
    Count
    12/1/2012 0:00
    AK
    1
    12/1/2012 0:00
    AK
    0
    12/1/2012 0:00
    AB
    1
    1/1/2013 0:00
    AK
    1
    1/1/2013 0:00
    AK
    0
    1/1/2013 0:00
    AB
    1
    3/1/2013 0:00
    AA
    1
    3/1/2013 0:00
    AK
    1
    3/1/2013 0:00
    AK
    0
    6/1/2013 0:00
    AA
    1
    6/1/2013 0:00
    AK
    1
    6/1/2013 0:00
    AK
    0
    9/1/2013 0:00
    AA
    1
    9/1/2013 0:00
    AK
    1
    9/13/2013 0:00
    AK
    1
    10/1/2013 0:00
    AA
    1
    10/1/2013 0:00
    AK
    1
    10/1/2013 0:00
    AK
    0

    Hi,
    Thanks for the query but this query gives the total count like shown below
    if see the second row in the below table AK for 2012-12-1 gives total count as 2 but need the query to show the first row as 1 and there after 0
    query result
    Month name cnt
    2012-12-01 00:00:00.000 AB 1
    2012-12-01 00:00:00.000 AK 2
    2012-12-01 00:00:00.000 AK 2
    2013-01-01 00:00:00.000 AB 1
    2013-01-01 00:00:00.000 AK 2
    2013-01-01 00:00:00.000 AK 2
    2013-03-01 00:00:00.000 AA 1
    2013-03-01 00:00:00.000 AK 2
    2013-03-01 00:00:00.000 AK 2
    2013-06-01 00:00:00.000 AA 1
    2013-06-01 00:00:00.000 AK 2
    2013-06-01 00:00:00.000 AK 2
    2013-09-01 00:00:00.000 AA 1
    2013-09-01 00:00:00.000 AK 1
    2013-09-13 00:00:00.000 AK 1
    2013-10-01 00:00:00.000 AA 1
    2013-10-01 00:00:00.000 AK 2
    2013-10-01 00:00:00.000 AK 2

  • SQL query to get the Datetime 06 hours prior to the table Datetime value

    Hi Experts,
                    I'm just trying to create a SQL query to get the Datetime which should be 06 hours prior to my Table column value(Executiontime),
    Eg: my Executiontime(column) value is 07:00AM means, this query should fetch the detail of first VMName from table at 01:00AM, 
    SQL Table Name: TestTable
    Columns: VMName(varchar),status(varchar) Executiontime(Datetime)
    SQL Query : Select Top 1 VMName from
    TestTable where convert(date,Exeutiontime)=convert(date,getdate()) and
    status='0' and ExecutionTime > dateadd(hour,6,getdate())
    Request someone to alter this Query to my requirement or give me the new one.
    Regards,
    Sundar
    Sundar

    Hi All,
            Thanks for your Prompt response. I tried the below queries, but still I don't have any luck. Actually the queries are returning the value before the condition met (say when the time difference is more than 06 hours). I want the
    query to return exactly @ 06 hour difference or less than 06 hours,
    Query 01: Select Top 1 VMName from TestTable where
    convert(date,Exeutiontime)=convert(date,getdate())
    and status='0'
    and ExecutionTime >
    dateadd(hour,-6,getdate())
    Query 02: Select
    Top 1 VMName from TestTable where
    status='0'
    and ExecutionTime >
    dateadd(hour,-6,getdate())
    Query 03: Select
    Top 1 VMName from TestTable where status='0'
    and ExecutionTime >
    dateadd(hour,-6,ExecutionTime)
              Can someone point out the mistake please.
    Regards,
    Sundar
    Sundar

  • SQL query to get the list of approvals

    Hi,
    Could someone let me know the SQL query to get the list of all the pending approvals for a user in OIM 11g R2.
    Thanks

    There are a few ways to do this:
    -  The easiest would be to use a Relationship Query from the CMC. To do this, go to the Universes section on the CMC, right click on the relevant universe, select tools >> Check Relationships.
    - Use Query Builder. You will need more than one query to pull the information you need. You could try something like the below (for Webi)
    SELECT SI_NAME, SI_WEBI, SI_DATACONNECTION FROM CI_APPOBJECTS
    WHERE SI_KIND = 'universe' and SI_NAME = 'Universe Name'
    This will give you a list of Webi Reports by SI_ID.
    You'll need another query to list Webi report names:
    SELECT SI_NAME FROM CI_INFOOBJECTS WHERE SI_ID IN (SI_ID from query above)
    - This is trivial via Auditing / the Activity universe. This of course will only return reports that have already run.
    Best.
    Srinivas

  • Function Module to get pernr number based on first name and last name

    Hi All,
    What is the Function Module to get pernr number based on first name and last name.
    Could you please help me.
    T@R.
    Vidya

    hi Vidya,
    you can get perner from PA0002 based on firs name and last name.
    use select query and get perner.

  • Query to get the records with same last name

    I need to write a single sql query to get all records with duplicate last_name's. For example, if tab1 has 4 records:
    10     Amit     Kumar
    20     Kishore          Kumar
    30     Sachin     Gupta
    40     Peter     Gabriel
    then the query should return
    10     Amit     Kumar
    20     Kishore     Kumar
    id, name,L_name being the 3 columns in table
    Apprecite you help.
    Thank you
    Mary

    SQL> create table mytable (id,name,l_name)
      2  as
      3  select 10, 'Amit', 'Kumar' from dual union all
      4  select 20, 'Kishore', 'Kumar' from dual union all
      5  select 30, 'Sachin', 'Gupta' from dual union all
      6  select 40, 'Peter', 'Gabriel' from dual
      7  /
    Table created.
    SQL> select id
      2       , name
      3       , l_name
      4    from ( select t.*
      5                , count(*) over (partition by l_name) cnt
      6             from mytable t
      7         )
      8   where cnt > 1
      9  /
                                        ID NAME    L_NAME
                                        10 Amit    Kumar
                                        20 Kishore Kumar
    2 rows selected.Regards,
    Rob.

  • Query to find out the table name and column name..

    Hi Experts,
    I have an Oracle DB in which has more than 50 tables and 100,000 records. I want to get the record which contains *"ITxtVarValue references a non existing text"* the text.
    Is there any query there to find out the table name and column name of this particular record where it reside?
    Please help. Any help will be rewarded.
    Thanks,
    G

    Using this forum's search function, I found a thread that should give you an idea: How to find out a tablename
    C.

  • SQL query to get a list of relations between workitems

    How can I create a SQL query to get a list of all problems with related changes?  And all problems with related incidents?
    I have tried to join the tables RelationshipTypeDim with ProblemDimKey and ChangeRequestDim, but the results are not correct.

    The relationships in the data warehouse can be kind of tricky. The relationships are contained in the WorkItemRelatesToWorkItemFactvw table. This table lists the related items by their WorkItemDimKey, so you cannot reference directly from the ChangeRequestDimvw
    or ProblemDimvw. You will need to reference the WorkItemDimvw to get the WorkItemDimKey for each entry.
    The query below will get all of the related work items from the Change Request class. The way the joins work is ChangeRequestDimvw gets the list of change requests. Then inner joins WorkItemDimvw to get the WorkItemDimKey for each CR. Then inner joins WorkItemRelatesToWorkItemFactvw
    to get all of the CRs with related work items. Then inner joins the WorkItemDimvw again to get the ID of the related work item. 
    Now the tricky part is it appears that these relationship are set based on which item  that created the relationship. So you need to union a second query that reverse the relationship on the WorkItemRelatesToWorkItemFactvw. 
    This query should give you a good start on getting the related work items. You can filter it down from here if you only want to include problems.
    SELECT C.ID, WIWI.ID
    FROM dbo.ChangeRequestDimvw C
    INNER JOIN dbo.WorkItemDimvw WI ON
    WI.EntityDimKey = C.EntityDimKey
    INNER JOIN dbo.WorkItemRelatesToWorkItemFactvw AS WIRWI ON
    WIRWI.WorkItemDimKey = WI.WorkItemDimKey
    INNER JOIN dbo.WorkItemDimvw AS WIWI ON
    WIWI.WorkItemDimKey = WIRWI.WorkItemRelatesToWorkItem_WorkItemDimKey
    union
    SELECT C.ID, WIWI.ID
    FROM dbo.ChangeRequestDimvw C
    INNER JOIN dbo.WorkItemDimvw WI ON
    WI.EntityDimKey = C.EntityDimKey
    INNER JOIN dbo.WorkItemRelatesToWorkItemFactvw AS WIRWI ON
    WIRWI.WorkItemRelatesToWorkItem_WorkItemDimKey = WI.WorkItemDimKey
    INNER JOIN dbo.WorkItemDimvw AS WIWI ON
    WIWI.WorkItemDimKey = WIRWI.WorkItemDimKey
    Order by C.ID
    Matthew Dowst |
    Blog | Twitter

  • SQL query to get last 6 months records neglect the current month

    Hi All;
    I need help with 
    sql query to get last 6 months records neglect the current month
    Any help much appreciated
    Thanks
    Pradnya07

    SELECT <> FROM tbl WHERE dt >=dateadd(month,-6,GETDATE())
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to get the class name and field name dynamically

    Hi
    I have a class (ex: Contract) the fields (ex : a,b,c) .i need to get the class name and field name dynamically
    ex
    if( validation file for the field Contract.a){
    return contract.a;
    }else if(validation file for the field Contract.b){
    return contract.b;
    how to pass the field name and object dynamically
    Please help me .............
    Thanks in Advance..
    Edited by: 849614 on Aug 11, 2011 6:49 AM

    YoungWinston wrote:
    maheshguruswamy wrote:
    Agreed, but IMO, i still feel its best if there is no tie in between consumer class level details and the database it talks to. A service layer is needed in between them.Sounds like you've done a bit of this before. Me, I've either been a modeller/DBA, doling out data, or a nuts and bolts programmer (and actually more toolmaker than apps, but did a bit of that too).
    Do you know of a good book about the "middle ground" (ie, these service layers)? I understand it empirically, but haven't had a lot of exposure to it.
    Winston
    Edited by: YoungWinston on Aug 11, 2011 10:34 PM
    PS: Apologies. Edited my previous post, presumably while you were composing your reply, when I finally realized what '.filed' meant.Most of my work is in web development, never been a DBA :) . The biggest 'concern' in my shop is 'separation of concerns'. The UI group reports up to a different IT head, the DB group reports up to a different IT head and so on. The looser the coupling between these systems, the lesser the project costs (Integration, QA etc) are. Martin Fowler's books contain good information about separation of concerns in an enterprise environment. The two books which i recommend are
    [url http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420]Enterprise Application Architecture and
    [url http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683/ref=pd_sim_b_1]Enterprise Integration Patterns

  • Dear Gurus, Can i have SQL query to get Ar cash receipt appled lines details in R12

    Dear Gurus, Can i have SQL query to get Ar cash receipt appled lines details in R12

    I need to get ar and ap details from GL through xla.For ex: Reference1,reference2,reference3,reference4,reference 5, in 11i these column values are displayed in gl_je_lines where as in R12 we need to join xla tables with gl_sl_link_id and gl_sl_link_table
    Can someone provide query to get subledger details particularly ar and ap?.How are the AP & GL Journal Tables linked? [ID 1188714.1]
    R12 Mapping Between Subledger Tables, SLA and GL Tables [ID 871622.1]
    eTRM
    http://etrm.oracle.com/
    Thanks,
    Hussein

  • SQL query to get transaction detail from DEFERRED_TRAN_ID

    Hi,
    I'm using Oracle Advance Replication and get the transaction detail from Enterprise Manager Console.
    So instead of using the console.
    Is there a way any SQL query which get transaction details like SQL query fired, old and new column value etc from DEFERRED_TRAN_ID.
    thanks

    quote:
    Originally posted by:
    lucapac
    I have two tables: tblWorkers and tblSkills. tblWorkers has a
    column, Skills, which is populated from a multiple-checkbox form
    field with one or more skill_IDs from tblSkills, so each
    tblWorkers.Skills consists of a list of one or more comma-delimited
    values. For any Skill_ID, I need to generate a listing of all
    Workers with the corresponding skill, so I have tried to do
    something along the lines of SELECT WorkerName FROM tblWorkers
    WHERE Skills IN (Skills, #FORM.Skill_ID#) ... or WHERE Skills IN
    (ListFind(Skills, #FORM.Skill_ID#)) ... etc. ??? My results (once I
    got data type mismatches out of the way) return all Workers, not
    just those with the desired Skill. There must be an easy way to do
    this ... How do people with a bit more CF/SQL experience than I
    have do this???
    As Kronin implied, we normalize our databases. If you don't
    understand that answer, the book "Database Design for Mere Mortals"
    is often mentioned on this forum.

  • MS SQL query to get Subscription list from Operations Manager

    Hi Experts,
    Is there anyway get Subscription list from Operations Manager DB using SQL query?  I lost subscription list, and need to create subscription as it was. Very urgent.
    Thanks in advance.
    Regards
    Karthick M

    Hi,
    Hope the powershell command Get-SCOMNotificationSubscription can be helpful for you:
    Get-SCOMNotificationSubscription
    Retrieves a list of notification subscriptions.
    https://technet.microsoft.com/en-us/library/hh918490(v=sc.20).aspx
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • SQL query to get DDL for Adding PK.

    Guys,
    I'm looking for SQL query that gets me the "ALTER TABLE <TABLE_NAME> ADD CONSTRAINT <constraint_name> PRIMARY KEY (X,Y,...);" statments of all tables in my schema containing Primary Keys.
    Could someone help me with the query please?
    Regards,
    Bhagat

    You need this
    SELECT 'ALTER TABLE '||table_name||' ADD CONSTRAINT '||constraint_name||' PRIMARY KEY ('||column_name||');'
      FROM ( SELECT uc.table_name
                   ,uc.constraint_name
                   ,RTRIM (XMLAGG (XMLELEMENT (ucc, column_name || ',')).extract ('//text()'), ',')  column_name
              FROM user_constraints        uc
                  ,user_cons_columns       ucc
             WHERE uc.constraint_type      = 'P'
               AND uc.constraint_name      = ucc.constraint_name
          GROUP BY uc.table_name
                  ,uc.constraint_name
    ORDER BY table_name;   Regards
    Arun

Maybe you are looking for

  • G5 locking up, random screen pattern lock ups

    Alright, this is actually my brother's computer, which he's had for at least a year and half, with no problems. I just recently started using it to play a computer game, World of Warcraft. The game ran smoothly with no problems for a couple of weeks.

  • How do I changed to a different country without losing my itunes balance?

    Hello. I accidently changed my devices location to US on my iPhone. I just put in my giftcard, now it won't let me purchase till I change it back to Canada (live there) but I can't until I use up my money?? HELP.

  • Imposible to activate characteristic with one reference attribute in 3.5

    Dear Experts, I have a really strange problem in 3.5 version. I have ZUTSUP attribute like reference char from 0FUNCT_LOC. I deleted one Z Character Attribute from 0FUNCT_LOC, when I try to active it shows one error. "Characteristic 0FUNCT_LOC: Maste

  • Class Cast exception in oracle.sql.ArrayDescriptor

    hi i am trying to pass ArrayList to Oracle procedure but when i am excuting the code i got the following error java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with oracle.jdbc.OracleConnection Can anybody help me

  • PXI-6534 Card using Traditional Legacy Card to DAQmx driver

    I don't know where to start..I am stuck on an issue that needs to be solved. I am using a Traditional legacy driver on a PXI-6534 Card.  I want to move it to using the DAQmx driver. Can someone point me to the right direction? Thank you.. Best regard