# SQL2000 Round Function

Hi All,
SELECT dbo.Duration * dbo.Price AS TOTAL_PRICE

The current result rounds of with no decimal places. How can we have TOTAL_PRICE with 5 decimal places even if it shows for example 5.00000

Thanks!
Microsoft SQL Server

Last Comment
chiragkhabaria
chiragkhabaria

THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
batman32

Thanks,
It works, but why we getting the last result as currency? ex \$ 5.7980
SELECT dbo.Duration * , Cast(Round(dbo.Price,0) As Decimal(7,6)) AS TOTAL_PRICE
batman32

can you post what query you wrote..

You have to write the ROUND Function.. before that .. have a look at my query again..

Select Cast (Round(5.7980,0) as decimal(7,6))
batman32

HI,
SELECT dbo.Duration * Cast(dbo.Price As Decimal(7,6)) AS TOTAL_PRICE
is working, please tell us how to change the curency from US \$ to anything else. All our fields are numeric....

Thanks!
you mean to say you are getting the output with \$ sign?? can you post what kind of output u r getting
batman32

USD (dollar sign) is our otput, but we need it just numeric
SELECT Cast(dbo.Duration * Cast(dbo.Price As Decimal(7,6))  As numeric (6,7) AS TOTAL_PRICE

??
batman32

Incorrect syntax near '6'
opps typo

SELECT Cast(dbo.Duration * Cast(dbo.Price As Decimal(7,6))  As numeric (7,6)) AS TOTAL_PRICE
batman32

Arithmetic overflow error converting numeric to data type numeric.
The statement has been terminated.

Dude, we are completely lost...
Are you using Query Analyser for running this..

Then do the following setting

1) Go to the Tools --> Options

2) In the Options go to the Connection Property.

3) There uncheck the option Use Regional Setting....

4) Then run this query..

SELECT dbo.Duration * Cast(dbo.Price As Decimal(7,6)) AS TOTAL_PRICE

Hope fully it should work fine..
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts

TRUSTED BY