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


Comparing Stored Procedures, Part 2


Comparing Stored Procedures, Part 2

Author
Message
Jesse McLain
Jesse McLain
Right there with Babe
Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)

Group: General Forum Members
Points: 749 Visits: 573
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
Brett Phipps
Brett Phipps
Mr or Mrs. 500
Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)

Group: General Forum Members
Points: 525 Visits: 230
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.
YSLGuru
YSLGuru
SSCertifiable
SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)

Group: General Forum Members
Points: 7446 Visits: 1668
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!
Jesse McLain
Jesse McLain
Right there with Babe
Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)

Group: General Forum Members
Points: 749 Visits: 573
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
Brett Phipps
Brett Phipps
Mr or Mrs. 500
Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)Mr or Mrs. 500 (525 reputation)

Group: General Forum Members
Points: 525 Visits: 230
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.
Jesse McLain
Jesse McLain
Right there with Babe
Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)Right there with Babe (749 reputation)

Group: General Forum Members
Points: 749 Visits: 573
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
Iwas Bornready
Iwas Bornready
One Orange Chip
One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)

Group: General Forum Members
Points: 29446 Visits: 885
Thanks for the script.
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