|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Calculate time between two feilds
Hi,
I am new to SQL. I need to calculate the time between DateSent(shows MM/DD/YYYY and HH:MIN:SS) to DateAssigned (shows MM/DD/YYYY and HH:MIN:SS) for the month of march. The table is HelpDesk_requests. Can you pl help me how to code a SQL query. Thanks. Gargi |
|
#2
|
||||
|
||||
|
You want to calculate the days, hours, minutes???
What format do you want it returned in? |
|
#3
|
|||
|
|||
|
I want it return in Hours and Minutes.
Thanks. |
|
#4
|
||||
|
||||
|
Example:
Code:
Cast(DateDiff(hh, DateSent, DateAssigned) As varchar) + ' hours ' + Cast(DateDiff(mi, DateSent, DateAssigned) As varchar) + ' minutes' |
|
#5
|
|||
|
|||
|
I tried the code you gave , but it gives me an error, "Line1: Incorrect Sysntax near 'DateDiff'
|
|
#6
|
||||
|
||||
|
post your complete sql statement
|
|
#7
|
|||
|
|||
|
It worked. I think i was putting it wrong. Thanks for your help.
|
|
#8
|
||||
|
||||
|
If my post was helpful, click the scales icon to show your appreciation.
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Calculate time between two feilds |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|