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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Average Function

Author  Topic 

lane0618
Posting Yak Master

134 Posts

Posted - 2002-06-27 : 12:29:55
How can I change the statement below to round 5 places instead of just taking the first 5 characters?

select left(avg(ship_wt),5) as avg1 from dbo.ship_FTM

Thanks!
Lane

VyasKN
SQL Server MVP & SQLTeam MVY

313 Posts

Posted - 2002-06-27 : 12:33:39
Try something like this:

select CAST(avg(ship_wt) AS numeric(10, 5)) as avg1 from dbo.ship_FTM


--
HTH,
Vyas
http://vyaskn.tripod.com
Go to Top of Page

lane0618
Posting Yak Master

134 Posts

Posted - 2002-06-27 : 13:09:36
Perfect, thanks!

Lane

Go to Top of Page

VyasKN
SQL Server MVP & SQLTeam MVY

313 Posts

Posted - 2002-06-27 : 13:15:06
Make sure you adjust "numeric(10, 5)" as needed. I don't know your data, so that was just an example. Specify a size that can accommodate ship_wt.

--
HTH,
Vyas
http://vyaskn.tripod.com
Go to Top of Page
   

- Advertisement -