?
Solved

T-SQL formating data

Posted on 2011-09-28
4
Medium Priority
?
253 Views
Last Modified: 2012-06-21
I have a nvarchar field called Grade1 and the value is 360.. I need the value to be 400 based on a 10% markup and rounded to the nearest 5.. The next number is 385 and I need that to be 425 and so on.. Do I do something like this select round(grade1*.1),1)?
0
Comment
Question by:cheryl9063
[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
  • 3
4 Comments
 
LVL 1

Author Comment

by:cheryl9063
ID: 36719873
I tried the below but got this error


Arithmetic overflow error converting nvarchar to data type numeric.
((((uph_Grade4) * .1)+4.9)/5)*.1

Open in new window

0
 
LVL 23

Accepted Solution

by:
wdosanjos earned 2000 total points
ID: 36719967
Please try:

ceiling((cast(uph_Grade4 as int) * 1.1) / 5) * 5

Open in new window

0
 
LVL 1

Author Comment

by:cheryl9063
ID: 36720010
it's now displaying 0
0
 
LVL 1

Author Comment

by:cheryl9063
ID: 36720045
Sorry.. I was wrong that worked!! Thanks!
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

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…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

764 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