Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7441445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:00:50+00:00 2026-05-29T11:00:50+00:00

Sample inputs: "Hi there how are you" "What is the #1 pizza place in

  • 0

Sample inputs:

"Hi there how are you"

"What is the #1 pizza place in NYC?"

"Dominoes is number 1"

"Blah blah 123123"

"More blah 12321 123123 123132"

Expected output:

"Hi there how are you"

"What is the #1 pizza place in NYC?"

"Dominoes is number"

"Blah blah"

"More blah"

I’m thinking it’s a 2 step process:

  1. Split the entire string into characters, one row per character (including spaces), in reverse order
  2. Loop through, and for each one if it’s a space or a number, skip, otherwise add to the start of another array.

And i should end up with the desired result.

I can think of a few quick and dirty ways, but this needs to perform fairly well, as it’s a trigger that runs on a busy table, so thought i’d throw it out to the T-SQL pros.

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:00:51+00:00Added an answer on May 29, 2026 at 11:00 am

    This solution should be a bit more efficient because it first checks to see if the string contains a number, then it checks to see if the string ends in a number.

     CREATE FUNCTION dbo.trim_ending_numbers(@columnvalue AS VARCHAR(100)) RETURNS VARCHAR(100)
        BEGIN
        --This will make the query more efficient by first checking to see if it contains any numbers at all
        IF @columnvalue NOT LIKE '%[0-9]%'
            RETURN @columnvalue
    
        DECLARE @counter INT
        SET @counter = LEN(@columnvalue)
    
        IF ISNUMERIC(SUBSTRING(@columnvalue,@counter,1)) = 0
            RETURN @columnvalue 
    
        WHILE ISNUMERIC(SUBSTRING(@columnvalue,@counter,1)) = 1 OR SUBSTRING(@columnvalue,@counter,1) = ' '
        BEGIN
            SET @counter = @counter -1
            IF @counter < 0
                BREAK
        END
        SET @columnvalue = SUBSTRING(@columnvalue,0,@counter+1)
    
        RETURN @columnvalue
        END
    

    If you run

    SELECT dbo.trim_ending_numbers('More blah 12321 123123 123132')
    

    It will return

    'More blah'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to I know event occurred by "for" attribute? Is there something like flag?
Say there is a special PHP function foo($number) that returns double the value of
Sample input string: char *str = 12345.567675; And the desired output if I need
My sample input XML is: <root> <a> <b>item</b> <b>item1</b> <b>item2</b> <b>item3</b> <b>item4</b> </a> </root>
So i have a simple form that takes a few inputs (two text and
I find some code sample with these oddl lines QList<TDataXml *> *newXMLData = input->getValue<QList<TDataXml
I have a sample code: <table id=modem_list> <tr class=input_1 name=modem> <td>iPad 1<input type=hidden value=1
I have a script.I will show sample. <form> <textarea id='input'></textarea> <input onclick=convert() value=go function
package pack; public class sample{ public static void main(String input[]) { NumberFormat numberFormat =
I followed these two exemples of developer.android (Creating an Input Method, Soft Keyboard sample).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.