Set a value based on a return value from another SP

  • I have a view that returns an inordinate amount of data. However, for reasons I don't wish to bore anyone with I would like to add a field to this view that has its value based upon the return value from another Stored Procedure.

    I have no idea how to call a Stored Procedure from within a view, passing a parameter to it and set a field to the return value. Any advice would be gratefully received.

     

    Steve.

  • You cannot use SP there. Create a function which returns the value and use it in the View.

    If you have SQL Server 7.0 or less you convert your view into stored procedure.

    Regards,
    gova

  • Now If the amount of data is that big and you ad afuntion to the view be ready to CRAWL

    I would doit the other way around:

    I would create a function that wraps that view and posibly filters the view therfore you and up with a parametrized view

    call it like this

    select * from dbo.Your_function(@parameter)

     

     


    * Noel

  • Oh it will crawl, of this I'm sure. However, it's to replace a report our users currently have posted to them so I'm hoping I can at least improve on that!

    It's fairly involved and I can see it being something I will have to revisit with the luxury of time to improve it somewhat, but for now I have to use a lot of existing code just to get it done by the deadline.

     

    Thanks for your time,

    Steve.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply