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 2005 Forums
 Transact-SQL (2005)
 Value rounding to '.00'

Author  Topic 

eljapo4
Posting Yak Master

100 Posts

Posted - 2011-12-12 : 06:58:36
Hi as you can see from my select
SELECT    DISTINCT 
MIN(T0.PostingDate) AS 'StartPostingDate',
MAX(T0.PostingDate) AS 'PostingDate',
-- DATEDIFF(ss, MIN(T0.PostingDate), MAX(T0.PostingDate)) AS 'SecsTimeFrame',
CAST((DATEDIFF(ss, MIN(T0.PostingDate), MAX(T0.PostingDate)) / 60)AS Decimal(18,2)) AS 'MinsTimeFrame',
T2.OrderNo AS 'Order#',
T0.LotNumber AS 'Lot',...


The MinsTimeFrame is being returned as a whole number followed by .00 when in fact I'd like the actual seconds value/60 returned to 2 decimal places. Can anyone help me please?

Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-12-12 : 07:27:43
change to divide by 60.0


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

Go to Top of Page

eljapo4
Posting Yak Master

100 Posts

Posted - 2011-12-12 : 09:18:35
that worked, thank you very much
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-12 : 10:35:30
quote:
Originally posted by eljapo4

that worked, thank you very much


see reason here

http://beyondrelational.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -