Solved

Remove . from value

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now