Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2004
    Posts
    1

    Unanswered: Return many tables

    Dear experts,

    I've just got the assignment to write a stored procedure or function. It was requested to return 3 tables from that sp or function.
    eg.
    table1
    fd1
    fd2

    table2
    fd2_1
    fd2_1

    table3
    fd3_1
    fd3_2

    It is posible for sp or function to return many tables at once? if so, which of them is better (sp and function).

    Thanks in advance for your help!

    Martin

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    A function can only return one result set. A well designed stored procedure will only return one result set, although it is possible for a stored procedure to return multiple result sets.

    You REALLY don't want to do this. A procedure that returns more than one result set is a sure symptom of bad design. When I see that in a database, it is a waring sign of amatuers at play!

    -PatP

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Yes, though if all the result sets have the same structure then you might be able to use a UNION query to consolidate them. If that's what you want...
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    OK, I'll byte..

    Who's the scrub that requested this?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Scrub? It sounds like a middle-management requirement to me.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •