Solved

remove trailing period

Posted on 2004-10-14
7
569 Views
Last Modified: 2012-06-21
I need to be able to remove a trailing period from all values in a column.

Eg.

table company(id, name, address)

some values in the name column are stored with a trailing period, such as 'ACME Inc.' or 'MyCompany Inc.'.

I need to comb through each record and remove the . (period) at the end of the name field.

Any suggestions? This is somewhat urgent, hence the 500 points reward.
Thanks.
0
Comment
Question by:danielvic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 1

Accepted Solution

by:
SirParadox earned 500 total points
ID: 12310095
UPDATE company SET Name=CASE WHEN RIGHT(name,1) = '.' THEN LEFT(name, len(name)-1) ELSE Name END
0
 
LVL 6

Expert Comment

by:RaisinJ
ID: 12310117
UPDATE Company SET Name = Replace(Name,'.','')
0
 
LVL 6

Expert Comment

by:RaisinJ
ID: 12310137
SirParadox's suggestion will work but, it assumes that all the '.' your trying to get ride of are at the end of you value in the "name" column...  The "REPLACE" function just simple replaces a character (anywhere in the string) with another character, in this case, Replace "." with ""...
0
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 

Author Comment

by:danielvic
ID: 12310139
there could be other periods in the name, but I only want to get the one at the end of the name.

So, I could have A.B.C. and I want to be left with A.B.C

I'll test SirParadox's solution.

thanks.
0
 
LVL 6

Expert Comment

by:RaisinJ
ID: 12310235
Yup, if you only want to get ride of the end period, use SirParadox's solution...
0
 
LVL 21

Expert Comment

by:mastoo
ID: 12310950
Minor and probably irrelevant point but if you want to avoid unnecessary updates:

UPDATE company
  SET Name=LEFT(name, len(name)-1)
  WHERE RIGHT(name,1) = '.'
0
 

Author Comment

by:danielvic
ID: 12311426
SirParadox's solution works.

I had to add an RTRIM on the name otherwise the . was not found.

Thanks for all you help!
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how the fundamental information of how to create a table.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question