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

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Comparing Stored Procedures, Part 2

By Jesse McLain,

This picks up from an earlier article on trying to quantify the comparison of two stored procedures.


For a more complete explanation, please go to my blog entry here.


Here's a sample of that blog entry that summarizes what this script does:

"I devised an algorithm that would compare blocks of lines between them, starting with the largest possible sequence to compare (the size of this would be the number of lines of the smaller spd), and then compare smaller and smaller sequences until the comparison size was just one line (which is what was compared in Comparing Stored Procedures, Part 1). The trick to this approach is that if a match was found between to large sequences of lines, the subsequences in them would never be compared. Although this certainly helps with performance, the real reason behind this is that the fact that large blocks of code matched is very meaningful. Take this example: the string 'ABCD' matches 'ABDC' more than it matches 'DCBA'. How much "more" it matches is the subject of a later posting, where we establish our scoring algorithm."


Written by Jesse McLain





Total article views: 2183 | Views in the last 30 days: 1
Related Articles

Best code for generating sequence numbers

Sequence generation



Add sequence number to rows


comparing 2 tables columns if they match or not?

comparing 2 tables columns if they match or not?


How to handle parallel objects sequence after conditional split for two different case

Conditional split and following parallel object sequence


Denali — Day 10: Sequence object

Denali – Day 10: Sequence object Sequence is an object introduced in Denali, this is similar to...

string comparison    
text matching