Finding Difference In Strings

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • willwmagic
    New Member
    • Feb 2007
    • 5

    #1

    Finding Difference In Strings

    Hey everyone, I am hoping someone can help me with a command that I am struggling to find. What I want to do is run a T-SQL command where it will return only the difference between 2 strings.

    For example: If i have "This is a test" and "This is a test which will be good", then i want the command to return "which will be good" I believed there had to be this sort of a command, but i could not find anything close to it. Any ideas on how i would accomplish this?
  • Binnong
    New Member
    • Jul 2007
    • 2

    #2
    Originally posted by willwmagic
    Hey everyone, I am hoping someone can help me with a command that I am struggling to find. What I want to do is run a T-SQL command where it will return only the difference between 2 strings.

    For example: If i have "This is a test" and "This is a test which will be good", then i want the command to return "which will be good" I believed there had to be this sort of a command, but i could not find anything close to it. Any ideas on how i would accomplish this?
    You may need a stored procedure to do this. CHARINDEX and SUBSTRING functions may be useful

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      what do expect when the strings are

      "This is a test" and "wow,This is a test" ???

      Comment

      • willwmagic
        New Member
        • Feb 2007
        • 5

        #4
        Originally posted by debasisdas
        what do expect when the strings are

        "This is a test" and "wow,This is a test" ???
        I am not so concerned with what is before the string match, but more so with what is after the matched string.

        Comment

        Working...