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)
Thank this author by sharing:
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. This excerpt from my blog helps to explain what this does:
"Initially using an iterative approach to this problem made a lot of sense, since we need to control the order of the subsequences checked (longer before shorter). There didn't seem to be an obvious way to do this with a CTE. The real power of the CTE comes from its feature of recursion - the ability to have a set of data in the CTE refer to itself (please go here for an excellent article on this). I developed a hybrid approach that would combine iterative and recursive code. The recursive CTE in it will select off the longest matching subsequence between the two sequences it can find whose values are all unmatched, save it in a temp table, and then update the two sequences to show the matching values. It would then continue doing this until no more matching subsequences can be found."
Written by Jesse McLain
In an effort to compare the text of two stored procedures, I generalized the problem and created cod...
Remove characters matched in a patindex pattern recursively.
Instead of Trigger not firing a subsequent trigger recursively
Possibility of recursive function