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

Comparing Stored Procedures, Part 2 Expand / Collapse
Author
Message
Posted Thursday, February 19, 2009 6:15 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, May 15, 2014 12:28 PM
Points: 305, Visits: 565
Comments posted to this topic are about the item Comparing Stored Procedures, Part 2

Jesse McLain
jesse@jessemclain.com
www.jessemclain.com
www.jessesql.blogspot.com
Post #660220
Posted Tuesday, March 29, 2011 9:36 AM


SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, July 29, 2014 2:50 PM
Points: 95, Visits: 219
This is a reinvention of the wheel. There are a number of products that can do file comparisons and would've taken a lot less time to aquire and use than you spent writing this frivilous code.

If you billed this out to a client you should be ashamed of yourself.

Why was this a featured script on the SQLServerCentral daily newsletter as this definitely would not be a good practice to write sql to do a file comparison like this.

Post #1085649
Posted Tuesday, March 29, 2011 12:16 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 9:58 AM
Points: 886, Visits: 1,545
bphipps-931675 (3/29/2011)
This is a reinvention of the wheel. There are a number of products that can do file comparisons and would've taken a lot less time to aquire and use than you spent writing this frivilous code.

If you billed this out to a client you should be ashamed of yourself.

Why was this a featured script on the SQLServerCentral daily newsletter as this definitely would not be a good practice to write sql to do a file comparison like this.



Did you read the thing? Its a comparison between 2 stored procedures and not 2 actual files. Thats not to say that there aren't products out there that can compare STORED PROCEDURES but your post reads like you have inteprted this as comaprison of 2 files outside the database.


Kindest Regards,

Just say No to Facebook!
Post #1085772
Posted Friday, April 8, 2011 8:23 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, May 15, 2014 12:28 PM
Points: 305, Visits: 565
I started this exercise because I found it intellectually interesting. It stemmed from a task for a client, but of course this extended exercise I did on my own time. Although it's easy enough to take something like Windiff (which is usually included with Visual Studio), and view a line-by-line comparison of two sequences (in this case lines of code in a stored procedure), I also wanted some sort of quantifiable measure of comparison (e.g., the ability to say that these two sprocs are 87% the same). But more than anything, I was just curious about how such a process works.

That being said, this code could form the basis for a whole host of problems. For example, if you wanted to compare term papers submitted by college students to determine who is cheating, this code could be used for such a purpose. If you attacked the problem using a text comparer (like Windiff), you might have to look at every paper against every other paper (across the history of the class). But a process such as mine would allow you to narrow down the necessary manual comparisons. You could examine only papers with at least 3 matching subsequences of length 10, for example.


Jesse McLain
jesse@jessemclain.com
www.jessemclain.com
www.jessesql.blogspot.com
Post #1090676
Posted Friday, April 8, 2011 10:12 AM


SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, July 29, 2014 2:50 PM
Points: 95, Visits: 219
Yes, I read a large part of it, until I got to the point of "this makes no sense to do this when I would've already accomplished the objective before I finished reading this article." I understand that he is comparing stored procedures, but we store all of our stored procedures scripts as text files as save them in subversion. The process of saving any stored procedure as a text file is a 10 second task, so do it programmatically makes very little sense.

As for checking term papers, that sounds like a great idea, but that is not what you started out with or even suggested as a usage to begin with. Moreover, that's a different step altogether, because term papers are not stored procedures, and you would then have to load them into a database and I suspect there would be a lot of other items that would be different as well.
Post #1090770
Posted Friday, April 8, 2011 7:34 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, May 15, 2014 12:28 PM
Points: 305, Visits: 565
There are two advantages to comparing code programmatically versus manually: quantifiable results and the ability to automatically compare every stored procedure in a database to every other one. Imagine consulting on a project with a database with hundreds of stored procedures, and the manager who brought you in tasks you with reducing the redundancy in those stored procedures. Manually comparing them would take forever, and still not yield the best results.

The point of bringing up the example of comparing term papers was just to show that this code for comparing sequences is easily generalizable. The items in the sequence could be anything - lines of code, words in a term paper, or base pairs of DNA.


Jesse McLain
jesse@jessemclain.com
www.jessemclain.com
www.jessesql.blogspot.com
Post #1091017
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse