Solved

T-SQL formating data

Posted on 2011-09-28
4
245 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
  • 3
4 Comments
 
LVL 1

Author Comment

by:cheryl9063
Comment Utility
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 500 total points
Comment Utility
Please try:

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

Open in new window

0
 
LVL 1

Author Comment

by:cheryl9063
Comment Utility
it's now displaying 0
0
 
LVL 1

Author Comment

by:cheryl9063
Comment Utility
Sorry.. I was wrong that worked!! Thanks!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Server R2 Stored procedure performance 8 30
Oracle Subquery bad Join 11 40
SQL query 4 25
SQL Transaction logs 8 6
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

12 Experts available now in Live!

Get 1:1 Help Now