Trimming Values with SQL Server Express 2005

175 pts.
Tags:
RTRIM
SQL Server Express 2005
SQL Server Functions
TRIM function
I have a column whose values range from 10-15 characters and whose last 7 characters I would like to get rid of. Can someone please show me how to do this? I thought it would be RTRIM but that didn't work for me. I can't use LEFT or RIGHT before the column because the column length is variable. I would appreciate any help. Thanks much. So here is an example of what I want to accomplish below:    
PROBLEM EXAMPLE: 12345678.HELLO
FIXED EXAMPLE: 12345678


Software/Hardware used:
SQL Server 2005 Express

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try:

<pre>left(<field>, len(<field)-7)</pre>

This will discard the right-most 7 characters.

Discuss This Question: 1  Reply

 
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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Eabouzeid
    Beautiful! This worked perfectly. Thank you. I was initially creating a function for this but this is a lot simpler.
    175 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following