How to handle/manipulate the results of a stored procedure called from another stored procedure

  • Hello to all you gurus!

    Newbie to the max here! I have a stored procedure that returns a dataset (very wide) and I need to return just a subset of columns of said dataset (after performing some calculations and groupings). Since I cannot modify this SP because it is widely used by several other processes/applications, I was thinking about creating another stored proc, call this existing proc and store the dataset in a table variable and go from there but seeing that it returns almost 100 columns, it is very daunting. :sick:

    Is this the right approach or is there another way to accomplish this in a more efficient/best practices way?

    As usual, thank you all in advance for any help/direction you can provide.

    Kind regards,

  • Depending on how many rows are returned, you may want to use a temporary table instead of a table variable. Other than that, it sounds like you are on the right track.

  • Thanks Lynn!

    I guess I was just looking for confirmation. I did end up using a temp table for the rest of the manipulation and it is all good now.

    Again, thank you!

    😀

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

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