Query Help

  • I have two sub procedure which gave me value from different table like first procedure give me value from two table Supplier code, Sum(Qty Received) and sum (Qty Rejected). Second procedure gives me value from two tables Supplier Code and Count(Early) and Count (Late). Now I want a call these two procedure value in master procedure and I need results like this format.

     

    Supplier code, Qty Received, Qty Rejected, Count(Early), Count (Late)  - From two procedure and Supplier Name, Address and contact info from supplier table where supplier code is  @Supplier code and procduer1.supplier code = supplier.supplier code and procedure2.supplier code = supplier.supplier code

     

    My question is how can I link these two sub procedure values with my master procedure table. Should I create table at the end of each procedure and recall these sub procedures  in main procedure and then like those created table from sub procedures with master procedure table.

  • Unless things are singular values which you could pass with OUTPUT parameters from your sub procedures you will likely have to use a temp table which you can execut the proc results directly into with

     

    INSERT #x EXECUTE ip_Test...

    See BOL topic INSERT for more details and a good example.

    From their your two temp tables resultsets can be combined.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply