Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want round the amount to nearest rupee.

I.e. if I got 225 as amount it must be treat as 230.

And if 224 it must treat as 220.

How can it be done using roundoff in T-SQL?

share|improve this question
1  
WHat datatype are these values? –  ypercube Jun 23 '12 at 8:24
    
datatype used is numeric(19,6) –  Sivajith Jun 23 '12 at 8:33
8  
Have you read this?: ROUND() function. –  ypercube Jun 23 '12 at 8:36
5  
This part: When length is a **negative** number, numeric_expression is rounded on the left side of the decimal point, as specified by length. –  ypercube Jun 23 '12 at 8:45
8  
Dude, just read the link ypercube sent you. He even highlighted the relevant part for you. Put some effort into answering your own question now that we've practically led you to its doorstep. –  Nick Chammas Jun 23 '12 at 15:52
show 1 more comment

closed as off topic by Nick Chammas, Aaron Bertrand, Mark Storey-Smith, Martin Smith, Marian Jun 24 '12 at 14:54

Questions on Database Administrators Stack Exchange are expected to relate to database administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

up vote 1 down vote accepted

You can use the Round() function.

Eg:

Select Round(224,-1)

it returns the value 220

Select Round(225,-1)

it returns the value 230

Refer the following link http://msdn.microsoft.com/en-us/library/ms175003.aspx

share|improve this answer
add comment

As the comments have stated you can use the ROUND() function

create table t
(
  rupee money
)

insert into t values (225)
insert into t values (224)
insert into t values (221)
insert into t values (226)
insert into t values (231)

select round(rupee, -1)
from t

See SQL Fiddle with Demo

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.