Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 truncate the decimal value

Author  Topic 

shagil.a.gopinath
Starting Member

14 Posts

Posted - 2010-04-25 : 09:13:18

Hi, friends

My query output is 45.7829474, i need to get the output as 45.78, remaining part should be truncated. Is there any function sql to do this ?


Thanks and regards

shagil

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-04-25 : 09:15:04
round(45.7829474, 2)


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

ms65g
Constraint Violating Yak Guru

497 Posts

Posted - 2010-04-25 : 09:17:33
select cast(field as decimal(18,2)) from table_name
Go to Top of Page

shagil.a.gopinath
Starting Member

14 Posts

Posted - 2010-04-25 : 09:25:55
select cast(field as decimal(18,2)) from table_name


this method works well, by using round remaining all the value will be zero.

Thanks for your help friends

Go to Top of Page

ms65g
Constraint Violating Yak Guru

497 Posts

Posted - 2010-04-25 : 09:32:35
quote:
Originally posted by shagil.a.gopinath

select cast(field as decimal(18,2)) from table_name


this method works well, by using round remaining all the value will be zero.

Thanks for your help friends




you are welcome
Go to Top of Page
   

- Advertisement -