x
login about faq Site discussion (meta-askssc)

Compare results from different database

I have a stored procedure that I execute on different databases to present results. What's the easiest way to compare these results ?

more ▼

asked Jun 23 '12 at 06:15 AM in Default

davehd gravatar image

davehd
30 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort oldest

Funnily enough, I had the same requirement recently. I blogged my approach here: http://thelonedba.wordpress.com/2012/06/21/warning-wordbreaker-filter-or-protocol-handler-used-by-catalog-foo-does-not-exist/

The gist of the process is:

  1. Create temporary table (or two) to match the output of your stored procedure
  2. execute the stored procedure into the temporary table. This was complicated for me by it being on a separate server...
  3. Repeat, running the SP from the second server/database.
  4. Do your comparison.

It's all relatively straightforward, just a bit long-winded. I'm sure I could have written the code better, for example!

This technique only works if there is one recordset output by your SP.

Things you'll need to know about:

Hope this helps.

more ▼

answered Jun 23 '12 at 12:08 PM

ThomasRushton gravatar image

ThomasRushton ♦
30.1k 7 10 40

Yep, that worked beautifully and was quite simple. Thaks so much Thomas!

Jun 24 '12 at 05:44 PM davehd
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x215

asked: Jun 23 '12 at 06:15 AM

Seen: 286 times

Last Updated: Jun 25 '12 at 11:10 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.