Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi in my project i am need to multiply two columns. i am take table like
create table items(item1 float,item2 float, result as (item1 * item2))
insert into items values (145.45,154.25)
output display for 3rd column is 22435.6625
but my aim is result is disply like 22435.66 its enough
how to write a query.
Thanks.
Posted

Use the ROUND function.
SELECT ROUND(CAST(22435.6625 AS float), 2, 1)
 
Share this answer
 
SELECT CAST(22435.6625 AS NUMERIC(10, 2))


I think this may help u... :)
 
Share this answer
 
hello,

You query is correct now u want the result upto 2 decimal places thats 22435.66 well ajay all u have to do is use the round function in sql use the following query and u will surelu get the required output

the syntax given for round is
SELECT ROUND(column_name,decimals) FROM table_name
where column name is the name of the column that u want
decimal means: Specifies the number of decimals to be returned.

given below is ur query
select round(result,2) from items


do rate my answer once you find it useful

Thanks & Regards
Radix :rose:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900