• sumith1andonly1 (11/15/2012)


    i have the following:

    Stored Procedure 1 calls Query 1

    Stored Procedure 2 calls Query 2

    i would like to have:

    Stored Procedure 3 calling Query 1 and Query 2 and then combine results.

    Query 1 is to select data from table1

    Query 2 is to select data from table2

    Both table1 and table2 have same structure..

    My actual need is

    combine data from Query 1 and data from Query2 ,and return single data

    details..we need details.

    while it's technically possible to use OPENROWSET to treat the results of a procedure as a table, it's not practical.

    it's so not practical, i hesitate to even show it, but an example is at the end.

    the right thing to do is create a brand new procedure, and copy and paste the work that occurs in Procedure 1 and Procedure 2 to get you the final results you need. that means you do not NOT CALL the other procs...you create a new procedure to satisfy this new business need.

    obviously this new procedure would need all the parameters passed to both those other two procs.

    SELECT *

    FROM OPENROWSET( 'SQLNCLI',

    'Server=(local);Trusted_Connection=yes;',

    'SET FMTONLY OFF; SET NOCOUNT ON; exec Db_Name.dbo.spGetCategoriesByDocIDAsTable 811'

    )

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!