Solved

I need help with percentages in my SQL Server Query

Posted on 2014-02-09
2
369 Views
Last Modified: 2014-02-09
How do I turn varchar value 05600000 into the percentage value 5.6 in my SQL Server 2012 query?  Thank you very much in advance.

mrotor
0
Comment
Question by:mainrotor
2 Comments
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 200 total points
ID: 39845554
Something like this perhaps:
DECLARE @Value varchar(20) = '05600000'
SELECT CAST(@Value AS numeric(18,2)) / 1000000
0
 
LVL 16

Accepted Solution

by:
Surendra Nath earned 300 total points
ID: 39845555
SELECT CAST('05600000' AS DECIMAL(18,2))/100000

Open in new window

0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

706 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

13 Experts available now in Live!

Get 1:1 Help Now