SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Optimize SP


Optimize SP

Author
Message
bsilva.costa
bsilva.costa
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 72
Hi!

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.
WolfgangE
WolfgangE
SSC-Addicted
SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)SSC-Addicted (495 reputation)

Group: General Forum Members
Points: 495 Visits: 793
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search