Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Query help needed
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 08/26/2014 :  10:48:16  Show Profile  Reply with Quote
Hi ,

I need help in understanding the below query

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.


Starting Member

13 Posts

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

Starting Member

2 Posts

Posted - 08/27/2014 :  05:46:26  Show Profile  Reply with Quote
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.


Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000