how do we remove last repeated characters in string using sql

Tags:
nothing
example ramaxxaxx
how we remove only last two repeated characters in string


Software/Hardware used:
software
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    In what programming language, VB, C#, RPG, COBOL or SQL ?
    What have you tried, post your code and we will help you fix it..There are a number of way it can be done.


    136,490 pointsBadges:
    report
  • TheRealRaven
    Please show the expected result. Are you looking for [ ramaxxa ] or [ ramaxx ]? Also, what "sql" are you using?
    37,005 pointsBadges:
    report
  • Subhendu Sen
    Have you written a piece of sql for the same? If yes, you can come with this sql code and we can try to help.
    142,670 pointsBadges:
    report
  • TheRealRaven
    A third possibility came to mind -- perhaps you want the result to be [ ramaxxax ] where only the last repeated character is removed. Need to know what you are trying to do. And still need to know what "sql" will be used.
    37,005 pointsBadges:
    report
  • ToddN2000
    Sound like a class assignment. Here is some sample logic. Post your code and any eroors and we can help you resolve the problem.

    If it's always a random letter and random position you could create a procedure grab the length of the field then grab last two positions into a variable. Check variable if substring 1 = substring 2. If not equal then grab the next to last by subtracting 1 from the initial field length and repeat unto you reach the start of the field. Just exit when you reach the first matching pair. 
    136,490 pointsBadges:
    report
  • Subhendu Sen
    Please check here this can be helpful, https://www.tutorialspoint.com/sql/sql-string-functions.htm
    142,670 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: