February 19, 2009 at 6:15 am
Comments posted to this topic are about the item Comparing Stored Procedures, Part 2
March 29, 2011 at 9:36 am
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.
March 29, 2011 at 12:16 pm
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!April 8, 2011 at 8:23 am
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.
April 8, 2011 at 10:12 am
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.
April 8, 2011 at 7:34 pm
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.
May 17, 2016 at 6:44 am
Thanks for the script.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply