Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005

    Unanswered: Calling stored proc. multiple times...

    I have basic SQL query that returns a one column result set. For each row returned in this result set, I need to pass the value in the column to a stored procedure and get back a result set.

    I have 2 solutions, neither of which are very elegant. I'm hoping someone can point me in a better direction.

    Solution 1:
    Use a cursor. The cons here, are the SP returns a result set on each pass which generates multiple result sets overall. If there is a way to combine these result sets, I think this solution might work.

    Solution 2:
    Use a temp table or table variable.
    The cons here are, if the schema of the result set returned from the stored procedure changes, the table variable will have to change to accommodate it. This is a dependency I'd rather not create.

    Any help is very much appreciated.

  2. #2
    Join Date
    Jun 2003
    Provided Answers: 1
    Solution 3: Use a user-defined function instead of a stored procedure.
    If it's not practically useful, then it's practically useless.

    blindman "sqlblindman"

  3. #3
    Join Date
    Jun 2005
    Good idea. I'll give it a try.

Posting Permissions

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