Solved

trim zeros

Posted on 2012-04-03
1
228 Views
Last Modified: 2012-04-03
--default data = 3.125, 6.250, 12.500, 18.750, 50.000

select ID, left(sPercent,charindex('.',sPercent,+2)+2) as sPercent from perSize order by ID asc

--after running above = 3.125, 6.25, 12.50, 18.75, 50.00

--all i want to do is remove all trailing zeros so the data looks like: 3.125, 6.25, 12.5, 18.75, 50
0
Comment
Question by:fwstealer
1 Comment
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 37801447
Try:

select ID, cast(sPercent as float) as sPercent from @perSize order by ID asc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

862 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

26 Experts available now in Live!

Get 1:1 Help Now