• DECLARE @project AS TABLE (Projectid INT, ProjectName VARCHAR(100))

    DECLARE @Manager AS TABLE (Projectid INT, Managerid VARCHAR(100))

    DECLARE @Developer AS TABLE (Projectid INT, Developerid VARCHAR(100))

    DECLARE @User AS TABLE (Userid INT ,UserName VARCHAR(100))

    INSERT INTO @project

    values(1,'Impact'),(2,'Process'),(3,'Tester')

    INSERT INTO @User

    SELECT c.column_id, c.name FROM master.sys.[columns] c WHERE c.[object_id] =OBJECT_ID('master.dbo.spt_monitor')

    INSERT INTO @Manager

    VALUES (1,1),(1,2),(2,1),(3,1),(3,5),(3,4)

    INSERT INTO @Developer

    VALUES(1,1),(1,3),(1,4),

    (2,1),(2,3),(2,5),(2,6),(2,10),(2,8),

    (3,3),(3,6),(3,7),(3,8),(3,9),(3,10)

    Expected result would be like this

    PNameManagerDeveloper

    Testerlastruntotal_write

    Testeridleio_busy

    Testerpack_receivedpack_sent

    TesterNULLconnections

    TesterNULLpack_errors

    TesterNULLtotal_read

    Processlastrunlastrun

    ProcessNULLtotal_write

    ProcessNULLio_busy

    ProcessNULLpack_received

    ProcessNULLpack_sent

    ProcessNULLpack_errors

    Impactlastrunlastrun

    Impactcpu_busyio_busy

    ImpactNULLidle

    Every rule in a world of bits and bytes, can be bend or eventually be broken
    MyBlog About Common dialog control
    A Visualizer for viewing SqlCommand object script [/url]