?
Solved

Remove . from value

Posted on 2011-03-24
5
Medium Priority
?
275 Views
Last Modified: 2012-05-11
I need to replace the values in a table that have a value of xxx. with xxx (no decimal)
However if there is a number after the decimal I need to leave it alone.
Example  123. should become 123     but 123.4 should stay 123.4
The feild is type Char(9)
0
Comment
Question by:jtomascak
[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
5 Comments
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 2000 total points
ID: 35211575
update tbl
set col = left(col,len(col)-1)
where col like '%.'
0
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 35211635
update tbl
set col = left(col,len(col)-1)
where rtrim(col) like '%.'
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35211672
update tbl
set col = LEFT(col, CHARINDEX('.',col,0)-1) + RIGHT(col, (LEN(col) - CHARINDEX('.',col,0))
WHERE col like '%.'
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35211679
forget my last post i just reread the question
0
 

Author Closing Comment

by:jtomascak
ID: 35211916
That will do it.
this is what happen when you have a Network engineer playing DBA :)

thanks
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

752 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