SQL Server Performance

Two select queries in stored procedure.

Discussion in 'Getting Started' started by Ramaswamy, Aug 22, 2007.

  1. Ramaswamy New Member

    Hi
    I am having a stored procedure, which is having two select statement,
    like select * from table1
    and
    select * from table2
    if I execute the procedure, will it runs, if so how many result set will be created ? will it gets data from both the tables (table1 and table 2) and
    combine into as a single result set ? else it will have different result sets for different tables ? how it will be exectured ?
    Note : consider that the two tables are having different columns.
    can any one please clear my doubt.
    thanks in advance.
    ram
  2. ghemant Moderator

    Hi Ram,
    Welcome to the forum!!!
    This will create two different result sets and you will get data from both the tables.
  3. Ramaswamy New Member

    Thanks Hemantgiri
  4. Adriaan New Member

    It depends, but in most cases I would expect that your client application sees only the results for the last SELECT statement in your procedure.
  5. Madhivanan Moderator

    If needed return two resultsets. You can get all resultsets in the front end application
  6. Adriaan New Member

    It REALLY depends on the client application and which type of interface your developers have created.
    Not all client apps behave like QA.[;)]
  7. Madhivanan Moderator

    <P mce_keep="true">[quote user="Adriaan"] <P>It REALLY depends on the client application and which type of interface your developers have created.</P><P>Not all client apps behave like QA.<IMG alt=Wink src="http://sql-server-performance.com/Community/emoticons/emotion-5.gif"></P><P>[/quote]</P><P>I agree that it is difficult to handle them in Reports</P>
  8. satya Moderator

    I don't think so if you can wrap them into a SP [:D]
  9. Madhivanan Moderator

    <P mce_keep="true">[quote user="satya"] <P>I don't think so if you can wrap them into a SP <IMG alt="Big Smile" src="http://sql-server-performance.com/Community/emoticons/emotion-2.gif"> </P><P>[/quote]</P><P>The problem may happen when resultsets are completely differennt in structure [:)]</P>
  10. satya Moderator

    if I execute the procedure, will it runs, if so how many result set will be created ?
    Why not you execute them on the query analyzer?
    Also as referred by Adrian it depends, further for the performance related you could check the estimated execution plan.

Share This Page