I wrote a script to do this a little back. a script (Compare-QueryResults.ps1) is available here , and you will also need my Run-SQLQuery script (available here ), or you can replace it with a script or your own function.
Basically, what the script does is take the results of each of your queries and break the datarows so that each field is its own object. He then uses Compare-Object to check for differences between the data in these rows. It returns a comparison object that shows all the differences between the returned data.
The results are an object, so you can save them in a variable and use the Sort-Object or Format- * commands with them.
Good luck. If you have any problems with the scripts, let me know, I would be happy to guide you through them. I used them to test applications, seeing which lines are changed by various actions in the program.
source share