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 2012 Forums
 Transact-SQL (2012)
 Query help needed

Author  Topic 

Samsql2003
Starting Member

2 Posts

Posted - 2014-08-26 : 10:48:16
Hi ,

I need help in understanding the below query

select
count(1), avg( TranTime)
from dbo.tblTranTime
where TranStartTime >= dateadd(month,((2013-1900)*12)+12-1,19-1) + dateadd(ss,(11*3600)+(31*60)+00,0)
and TranStartTime <= dateadd(month,((2013-1900)*12)+12-1,19-1) + dateadd(ss,(16*3600)+(30*60)+59,0)

I need to change it to the sysday I run this query, not sure what values need to be changed.


samig

martes
Starting Member

13 Posts

Posted - 2014-08-27 : 04:59:09
Do you mean in place of TranStartTime? You could just use GETDATE(),
Go to Top of Page

Samsql2003
Starting Member

2 Posts

Posted - 2014-08-27 : 05:46:26
Hi Martes,
No, what I am looking for is in the below Query where can I change the Year(that I figured out of course-:) ),Moth,Day, Hour, Second. If I were to run this Query today lets say 2014 August 27th at 9:00 am in the morning where do I change the new values in the Query.

Also below is the Data in TranStartTime
Ex: 2014-08-27:9:00:20.207
Format, YYYY-MM-DD:HH:MI:SS.millisecond

The purpose of this Query is to measure the Average Transaction time it took to get the response from Server for something. The Avg(Trantime) is also stored in the database,The Trantime in the Database is already calculated for us as
TranStartTime-TranEndTime=Trantime( we are submitting several Records from an UI application and want to measure the Avg time it took to get the response from the Server.

Thanks





samig
Go to Top of Page
   

- Advertisement -