Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    21

    Question Unanswered: Using Stored Procs Results As Sub Queries

    Im trying to cerate a subset of procedures to help developers in my company write simpler SQL for example i want to write procedures who return a result set and then use them in a sub query for exmple

    Select * From tbl_Customers Where CustomerID IN
    (
    EXEC msp_Get_All_Cutomers_Over_The_Age(32)
    )

    msp_Get_All_Cutomers_Over_The_Age is a procedure which returns a result set that is valid (single field) for a subquery however this type of coding doesnt work.

    is it something i do wrong or im missing something here, it seems essential to me, how else can you reuse code.

    Thanks

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    I believe you want to use a view here rather than a stored procedure
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Feb 2003
    Location
    Milano, Italy
    Posts
    80
    Or, even better, a User Defined Function
    Davide Mauri
    http://www.davidemauri.it

Posting Permissions

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