[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

trim zeros

Posted on 2012-04-03
1
Medium Priority
?
236 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 2000 total points
ID: 37801447
Try:

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

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

873 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