GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Tech FAQs  >  SQL Server

 Print  |  
Question:  I have a table in sql server with two fields named 'start_time' and 'stop_time'. both fields have datatype set as 'datetime'. now I want to subtract the 'start_time' from 'stop_time'? I have tried datediff() fuction,but no use. I want the correct outpput of date as well as time .
Need help as early as possible.




April 04, 2007 02:50:30 #2
 MSenthil_DBA   Member Since: April 2007    Total Comments: 1 

RE: I have a table in sql server with two fields named...
 
Hi,

I don't know the problem, try this one

select datediff(hh, start_time, stop_time)  from table

gives difference hours between two time
     

 

Back To Question