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)
 Problwm with select quesry

Author  Topic 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2009-09-25 : 07:02:39
Dear All,

select emp_name,login_time,logout_time,datediff(mi,Login_Time,Logout_Time) as total_min,convert(float,datediff(mi,Login_Time,Logout_Time)/60) from Test

I have tried to get hh diffrence but it is not showing actual working
i want diffrence 9:43 but system is showing on;y 9.

Please help

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-09-25 : 07:07:28
Try this:

select emp_name,login_time,logout_time,datediff(mi,Login_Time,Logout_Time) as total_min,convert(decimal(6,2),datediff(mi,Login_Time,Logout_Time)/60.00) from Test
Go to Top of Page

sanjay5219
Posting Yak Master

240 Posts

Posted - 2009-09-25 : 07:08:34
Great it'w working

Thanks alot
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-25 : 07:10:07
Refer this
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-25 : 07:10:32


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -