In this example, first we need to declare a XML variable for assigning, it is like a normal value assignment using SET but we need to put a parenthesis of xml select clause. See below,

DECLARE @PFPRun XML
SET @PFPRun =
(           SELECT
            [vikingid], 
            [System], 
            [totalstrokes], 
            [TotalDocuments], 
            [Quality]
FROM
            tempdb..#tmpOverAllPFP       
FOR
XML PATH('PFPEmployees'),TYPE
)


After assingment, we have sent a bulk table as single parameter from one SP to another SP. See the below,

EXEC USP_PFPReportViewJob  @LOC,@DATE, @CreatedBy,@PFPRun

We also possible to use a Typed parameter or Table Variable instead of using xml

Comments (0)