Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Optimize SP Expand / Collapse
Posted Thursday, June 13, 2013 6:19 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 19, 2013 1:19 PM
Points: 4, Visits: 72

Next, we need to unify SP 2 has a size pretty damn considerably. =)

Let the following scenario:

Sp [A]
Sp [B]

The Sp [A] has a SELECT with 10 tables with inner join and left.
Both [A] as [B] are very complex and require a legal use of the server.

Hence the question, I need a unified report of [A] and [B] ..

How best to run?

Thank you.
Post #1463017
Posted Saturday, June 15, 2013 10:03 AM


Group: General Forum Members
Last Login: Wednesday, February 25, 2015 4:31 AM
Points: 199, Visits: 744
I'm not sure I understand your question or your post at all.

I think you have 2 procedures, each of them returning a result.
You want a result that unions the result of the two procedures.
You don't want to change the two procedures or even reuse their code as they are quite complex.

My suggestion:
Create a new procedure. There you call procedure A and store the result in a temporary table. Do the same calling procedure B.
Merge the two temp tables as needed and select them to return the data.
Post #1463867
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse