Solved

Remove . from value

Posted on 2011-03-24
5
273 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 500 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

739 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