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
 General SQL Server Forums
 New to SQL Server Programming
 Response Time

Author  Topic 

JVisconti
Starting Member

47 Posts

Posted - 2009-10-01 : 13:16:57
I have the following function:

UPDATE TicketMetrics SET ResponseTime =
CONVERT(varchar(10), HistoryFirstResponse -
TicketOpenDateTime /60.0)


This should be just a simple subtraction and I just want to make sure I have my synatx correct.

Sample Data:

TicketOpenDateTime HistoryFirstResponse

9/16/2009 9:41:00AM 9/16/2009 9:51:00AM

I want the return to be in seconds.

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2009-10-01 : 13:21:00
check DATEDIFF function

http://msdn.microsoft.com/en-us/library/ms189794.aspx
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-10-01 : 13:21:55
Sniped


DECLARE @s datetime, @e datetime

SELECT @s = '9/16/2009 9:41:00AM', @e = '9/16/2009 9:51:00AM'

SELECT DATEDIFF(ss,@s,@e)




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

JVisconti
Starting Member

47 Posts

Posted - 2009-10-01 : 13:27:50
Ok I changed the code into the DATEDIFF format, that returns me a whole number in seconds between the two. I need to get that into decimal format. Would it just be /60.0?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-10-01 : 13:38:11
and that would be minutes


DECLARE @s datetime, @e datetime

SELECT @s = '9/16/2009 9:41:00AM', @e = '9/16/2009 9:51:00AM'

SELECT DATEDIFF(mi,@s,@e)





Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

JVisconti
Starting Member

47 Posts

Posted - 2009-10-01 : 13:43:01
I knew it was something as simple, brain's not working like it should today. Thanks!
Go to Top of Page
   

- Advertisement -